-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fatal exception: concurrent modification exception #37
Comments
could you please give more context and steps to reproduce? |
Happens in prod after upgrade to okhttp5.0-alpha10. not able to reproduce locally |
please keep using latest okhttp 4.x. OkHttp 5 is not supported yet. |
Any plans to support it? We had to use fastfallback feature which is available in okhttp 5.0 |
you're welcome to contribute with a PR |
Hey this happens in older okhttp versions as well. Can you please provide a fix for concurrent modification exception |
What version are you using? Never experienced this personally, so as I asked initially, more context and steps to reproduce are needed to debug this, which needs to be replicated first. A test would be awesome and you're welcome to open a PR. As a quick check, ensure your code is not reading and accessing cookies from more than one thread and if so, consider synchronizing access. From what I see, the exception gets thrown from java.net.CookieManager which is JVM standard library. |
We are using 4.9.1.
|
Hey @gotev can we replace linkedhasmap to concurrentHashmap? It seems be thread safe |
So, are you using 4.9.1 with cookie store 1.5.0? From what I see, that snippet you posted is from the InMemoryCookieStore, but the posted stack trace at the beginning of the thread is not referring to it, but to java.net.CookieManager so I'm not getting the correlation between the two without further evidence, given also that InMemoryCookieStore has locked reads and writes. |
java.util.ArrayList$Itr.next (ArrayList.java:860) net.gotev.cookiestore.SharedPreferencesCookieStore.add (SharedPreferencesCookieStore.kt:107) java.net.CookieManager.put (CookieManager.java:360) net.gotev.cookiestore.WebKitSyncCookieManager.put (WebKitSyncCookieManager.kt:37)
The text was updated successfully, but these errors were encountered: