-
Notifications
You must be signed in to change notification settings - Fork 175
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
Graceful fail when cache index cannot be loaded #1097
Comments
This is currently in the 2.1.1 milestone. How close are you to a fix @jgosmann? Do you want me to attempt to fix this or should we punt to 2.2.0? |
I haven't looked at this at all yet. It would probably be nice to at least fail gracefully and recreate the index if it can't be loaded in 2.1.1 (or have a 2.1.2 release). Writing the index in a safer way could probably put of to 2.2.0, but might actually be not that complicated to implement. |
If you want to take a stab at it, go ahead. |
OK, I'll try a fix for failing gracefully, but yeah, do the atomic write in 2.2.0. Still waiting on a last review for #1088 so probably ok for 2.1.1. |
If the process is killed while writing the pickle, we can't load it anymore and thus lose all index information. Thus, we write it to another file first, so we still have the old index in case the process gets killed. Once we're done writing we rename the file (which should be atomic on most file systems and operating systems, but will at least be a much faster operation reducing the likelihood of ending up with an invalid index). Addresses #1097.
I'll take a stab at this now |
See #1110 |
If the process is killed while writing the pickle, we can't load it anymore and thus lose all index information. Thus, we write it to another file first, so we still have the old index in case the process gets killed. Once we're done writing we rename the file (which should be atomic on most file systems and operating systems, but will at least be a much faster operation reducing the likelihood of ending up with an invalid index). Addresses #1097.
If the process is killed while writing the pickle, we can't load it anymore and lose all index information. Thus, we write it to another file first, so we still have the old index in case the process gets killed. Once we're done writing we rename the file (which should be atomic on most file systems and operating systems, but will at least be a much faster operation reducing the likelihood of ending up with an invalid index). Addresses #1097.
Nengo raises an exception when the cache index cannot be read, but should handle this case graceful.
Here is a backtrace from a particular case where an incomplete index was written due to interrupting the process:
Besides handling an error on read graceful, it might also be good to do the writing in a more atomic way (e.g. write to a different file first and than rename the file; keep in mind that the files have to be on the same file system for this to be atomic and work without copying data).
The text was updated successfully, but these errors were encountered: