You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OMF code is incorrectly assuming that std::fs::File::try_clone returns an entirely separate file object. It does not: the returned object uses the same file handle and any seek affects all clones. This breaks OMF file reading in multi-threaded environments.
There are a couple of options for fixing this:
Implement a file deep copy. This would duplicate the underlying Unix file descriptor or Windows file handle using OS-specific code. I've written this elsewhere and it works.
Create a new implementation of std::fs::Read, wrapping Arc<File> and implementing clone that keeps the positions separate. This would again require OS-specific code, as Unix and Windows have slightly different implementations of the required calls: read_at vs. seek_read.
Either of these options could be added to the existing omf::file::sub_file::SubFile type. The second might make more sense there as it's already tracking the file position to implement the sub-file.
The text was updated successfully, but these errors were encountered:
The OMF code is incorrectly assuming that
std::fs::File::try_clone
returns an entirely separate file object. It does not: the returned object uses the same file handle and any seek affects all clones. This breaks OMF file reading in multi-threaded environments.There are a couple of options for fixing this:
Implement a file deep copy. This would duplicate the underlying Unix file descriptor or Windows file handle using OS-specific code. I've written this elsewhere and it works.
Create a new implementation of std::fs::Read, wrapping
Arc<File>
and implementing clone that keeps the positions separate. This would again require OS-specific code, as Unix and Windows have slightly different implementations of the required calls: read_at vs. seek_read.Either of these options could be added to the existing
omf::file::sub_file::SubFile
type. The second might make more sense there as it's already tracking the file position to implement the sub-file.The text was updated successfully, but these errors were encountered: