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

[TPC] Ensure file is closed prior to sending response to client #891

Merged
merged 2 commits into from
Jan 11, 2019

Conversation

bbockelm
Copy link
Contributor

@bbockelm bbockelm commented Jan 9, 2019

Previously, the underlying OFS file handle was not closed until the destructor on the XrdTpcStream object was called - this occurs after the response was sent to a client.

In this case, subsequent operations may be done while the file is still open for writing, which may mean data has not been written out from the client cache to the distributed file system. If the subsequent operation (such as stat) is load-balanced to a different data server, then the second operation may observe an incomplete file.

The fix is to explicitly cause the file handle to be closed prior to sending the response to the client. Then, as long as the filesystem has open-to-close consistency (which NFS and HDFS do have -- a much looser consistency requirement than POSIX), this should remove the possibility of reading an incomplete file.

This bug was revealed while testing load-balanced Xrootd on top of a HDFS filesystem at Nebraska. Depending on how often the race condition was triggered, it caused failure rates of up to 10%.

This ensures the user of the object is aware when the underlying file
has closed.

When the file is closed in the stream's destructor, we may have already
sent the response back to the client.  For filesystems that might
buffer significant amounts of data in the client library, it's possible
that subsequent operations on a different server attached to the same
distributed file system may see incorrect file sizes (as the open file
still hasn't been closed successfully).
@abh3 abh3 merged commit b428f49 into xrootd:master Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants