-
Notifications
You must be signed in to change notification settings - Fork 801
Detect out of space errors with posix_fallocate #445
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
Conversation
By switching from ftruncate to posix_fallocate we error out early if there isn't enough disk space for the incoming file. If we use ftruncate a sparse file is created that is then mmapped. As the bytes come over the network and the file is populated we get a SIGBUS when the kernel is unable to allocate space on the disk.
|
falloc can be really slow on some filesystems, are you sure this is worthwhile? |
|
For my application, I'd really like to make sure that the file made it across the network. I'm open to alternatives; the only one that I've come up with so far is a signal handler. Are there any other suggestions? |
|
Positive acknowledgement on success? |
|
The server does send an acknowledgement on success -- although the status isn't reflected in the client's exit code. But when there isn't enough space on disk the server gets a SIGBUS and then exits before it can send anything. |
|
I'd hoped that a SIGBUS signal handler that set a flag to tell _recv to return early would work, but it does not. The program stays stuck in rrecv after the SIGBUS is sent, so _recv never gets to do an early return. |
|
SIGBUS handlers are really tricky to make. It sounds liek you have everything you need, just make the sender fail if it doesn't get a positive ack. |
|
Yes, but to fail if I don't get a positive ack would require a timeout, and configuring that is somewhat problematic. Since I'm only using this in my own environment, and the posix_fallocate call isn't slow for my file systems, I'll just go with a local fork that uses posix_fallocate, and a slightly modified client that returns the status code it gets. |
|
CM should give you an immediate connection close after the SIGBUS, and since an Ack wasn't received that should be enough to report failure. |
|
I am not seeing an immediate connection close on the client when the server gets the SIGBUS; I'm seeing the client hang after the server crashes.
And then the client simply hangs, never getting to the close:
And a pstack shows that the client is stuck inside of the rsend:
|
|
Looks like a bug in rsockets.. |
By switching from ftruncate to posix_fallocate we error out early if
there isn't enough disk space for the incoming file. If we use
ftruncate a sparse file is created that is then mmapped. As the bytes
come over the network and the file is populated we get a SIGBUS when
the kernel is unable to allocate space on the disk.