-
Notifications
You must be signed in to change notification settings - Fork 190
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
Moved file-open operation in BinaryRecordingSegment out of constructor #3296
base: main
Are you sure you want to change the base?
Moved file-open operation in BinaryRecordingSegment out of constructor #3296
Conversation
…) method, and uses with statment so that the file will close after it's no longer needed
Sup, @cheydrick, hope you are doing well in Texas. The behavior in your PR is what I wanted to implement but @samuelgarcia pointed out some possible complication that we have not had time to test/experiment. The problem is that if the file is remote it might take a while to open it (this is what we want to do experiments with). If I remember well @samuelgarcia did some small experiments with its clusters and find some small effect in that direction. I still believe that this effect is a small price to pay for IO security but leaving the file handles open was the compromise we reached. Can you test the solution that @alejoe91 proposed on the linked issue? (to We should do more conclusive experiments to assess the cost of re-opening the file on every call when the files are remote but now that I think about it maybe we could solve this with a flag. We will have to wait till Sam returns from his vacations to discuss it. |
The suggestion that @alejoe91 made worked. I had first tried setting I closed the issue, but will wait for someone else to close this PR in case further discussion as you described should happen. Thanks for the replying @alejoe91 and @h-mayorquin! |
I updated #3295 to note that running Kilosort 4 prevents the .bin file from being deleted, despite first forcing deletion of the recording object. This PR remedies that, too, though obviously it doesn't address the big picture as @h-mayorquin noted. |
Hi @h-mayorquin, I would be interested in this patch since I am having the same problem! |
Hi. For me, when we do |
It is the case that every time a data chunk is accessed the file would need to be reopened and memory mapped? e.g. preprocessing a 1h recording in 2 second chunks, this would result in 1800 reopen-memory map-close cycles? I am not so familiar with the performance costs of this operation but it seems suboptimal if it is the case. However I've also got confused trying to figure out how to close the file handle to the recording object in a similar situation. Can this be solved by documentation and API e.g. can we add a |
I think there is some work on the Neo side for changing how memmapping will work for recording objects, but it has been on the backburner for a while. |
I recently report issue #3295 (BinaryRecordingExtractor opens the binary file, but doesn't close it, preventing later deleting or modifying binary file).
This PR fixes the problem that I described in that issue. I don't think it has any unwanted side-effects, though hopefully someone more familiar with the bigger picture will point out if it does!