-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Cache stops being written to when java.io.InterruptedIOException: thread interrupted #1903
Comments
@snodnipper are you calling |
... or are you calling |
thanks Jesse for getting back. I am going to have to check early next week - the calling code is proprietary, where I simply provided an adapter using okhttp. I am pretty sure it is just an ExecutorService with Essentially, the use case is:
I will try and provide some further feedback next week. Cheers! |
Right now OkHttp doesn't do well with interrupted threads. If you can use Call.cancel instead, things will probably work better. (And we should independently decide what to do about Thread.interrupt, if anything.) |
So the logic of the software is pretty simple:
I resolved it quickly by using MapDB as the cache. I then discussed a few options with folk, e.g. letting writes continue with another thread / using write ahead logs etc. We didn't want to put too much effort in without at least checking in with you guys. Given the above, I couldn't see a great place to use Call.cancel - the generic ExecutorService (within the external library) could be running anything to get data, such as reading straight from disk. |
@snodnipper got it. My guess is that |
added a crude project to demo the problem https://github.com/snodnipper/okhttp-issue1903-demo |
Any updates? |
Dupe of #1902, closing as won't fix. |
When requesting tens of files in separate threads, cancelling some results in an java.io.InterruptedIOException: thread interrupted exception that causes
hasJournalErrors = true;
.Consequently, within
private synchronized Editor edit(String key, long expectedSequenceNumber)
the cache is no longer updated because ofhasJournalErrors
.Once in this state I do not believe that
rebuildJournal();
is called until the cache is reinitialized. I looked injournalRebuildRequired()
but that does not consider the hasJournalErrors flag.Perhaps I should guard against threads being cancelled that are writing to the cache? RFC.
The text was updated successfully, but these errors were encountered: