Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the fix: Make EPERM from posix_fallocate work the same way as EINVAL #4957

Closed
ztane opened this issue Oct 14, 2021 · 1 comment · Fixed by #4958
Closed

Fix the fix: Make EPERM from posix_fallocate work the same way as EINVAL #4957

ztane opened this issue Oct 14, 2021 · 1 comment · Fixed by #4958

Comments

@ztane
Copy link

ztane commented Oct 14, 2021

#3195 was supposed to fix error handling when posix_fallocate. However it does not fix all of them: AWS has disabled the Linux fallocate and fallocate64 system calls in Lambda and some other environments by making them return EPERM instead of the common EINVAL.

The fix would be to handle EPERM analogous to EINVAL in util/file.cpp, i.e. change the if from

if (status == EINVAL) {
    return false; // Retry with non-atomic version
}

to

if (status == EINVAL || status == EPERM) {
    return false; // Retry with non-atomic version
}

Expected results

Realm-core should try to use the same fallback it uses when fallocate and fallocate64 return EINVAL.

Actual Results

Error message posix_fallocate() failed: Operation not permitted

Steps & Code to Reproduce

See for example https://stackoverflow.com/q/57825072/918959

Core version

Core version: all since je/fix-fallocate-problem was merged.

@fealebenpae
Copy link
Member

Hey @ztane, thanks for bringing this up and providing additional context. We’ll investigate the fix you propose and try to resolve the Lambda issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants