-
Notifications
You must be signed in to change notification settings - Fork 241
Concurrency Issue with Joda LocalDate #235
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
Comments
Thanks for the report, the workaround you decribe points to a concurrency issue in FSTConfiguration. Actually in the past the workaround was "works as designed", however due to memory consumption of metadata, FSTConfiguration was made multithreaded afterwards (with gaps obviously ;) ). |
The issue is caused by the clnames fields in FSTStreamEncoder and FSTStreamDecoder.
with
resolves the issue. It appears the class name registry has some concurrency issues that prevent it from working properly when the FSTConfiguration class is shared amongst threads. There is a workaround for this issue : by preregistering all the classes you want to serialize, the registry will be effectively immutable and not subject to this problem.
|
For reference, this might come handy for others (supplied by @slovdahl, thank you!). The way that @TheHound 's test case crashes is a "hard JVM crash", caused by a
|
The error is not consistent though, sometimes it fails with more "normal" JVM errors like this:
|
Well perhaps we should try to convince him to accept #254 or better yet provide a more performant fix :P |
@andrewl102 There was a clear plan suggested there so I tried bumping that PR a bit now. |
We've been hit by this issue with recent FST versions as well. As a consequence, we reverted back to version If you do not need any features introduced after that version I suggest downgrading until this issue is resolved. |
@theigl Thanks. The problem for us is that 2.10 is such an old version (2014) that I'm not sure it would work for our use case. |
@perlun: It is old, but there have not been too many changes to the serialization code since then. Just look at the commit diagram or the commit history. I'm usually not advocating 4 year old libraries, but as I said Having said that, I'd really love to see this issue resolved ;) |
@andrewl102 FWIW: I just tested your suggested workaround and it still runs into "unknown object tag -126" and similar errors sometimes, so it's unfortunately not a 100% safe fix. This is with Java 11.0.2. Java 8 surprisingly does not exhibit this error at all. I tried running the test 10 times on Java 8 without failure. On Java 11, it failed 3/10 times so 30% failures. Even increasing the number of threads on Java 8 couldn't make it fail, but the crashes described below are indeed with Java 8 so... I think that there is still some issue, it's just extremely intermittent. We are talking about "once every 1-2 hours if stress tested to the max constantly", i.e. flooding the server with requests using Gatling. So, it's a very annoying bug/race condition we are dealing with here. I will try a more long-running job with Java 8 now to see if I can provoke it to fail after, say 100 million iterations. Will keep you posted. This could explain some of the errors we've been seeing in one of our customer's test environments lately. Random crashes, most often with a We've debugged this at length in
@theigl Thanks for that. I tested version 2.10 and here are my conclusions:
I will stress test Java 8 with 2.10 and 2.57 in more long-running CI runs now, to see if 2.10 is stable even after 100 or 1000 million iterations. (Yes, we need this level of stability for our use case.) |
I opened a separate issue and added a repro repository, moving the discussion to #274 since the workaround suggested in this issue does not work => separate root cause. |
Hi @perlun Similar concurrency issues are discussed in other issues and it seems to be related to turning on G1GC garbage collection strategy that was introduced with Java 8 - but not turned on by default. I'm guessing the difference between your Java 8 and Java 11 experience is that in Java 11 G1GC is now on by default. I suggest that if you explicitly turn on G1GC in Java 8 you might be able to see the problem there also - which is the experience on some of the other issue reports. |
Hi guys, Actually its necessary to turn of use of Unsafe in order to get better diagnostics. This should be possible by setting the Unsafe singleton to null afair. |
Should be fixed by #311 . Please check. |
Uh oh!
There was an error while loading. Please reload this page.
I am running fst 2.48 and joda-time 2.9.9.
The following test case errors most of the time:
I have been able to work around the issue by using a ThreadLocal for FSTConfiguration. I don't think this is an issue with Joda as replacing the FST serialization with Java Serialization doesn't appear to cause an issue.
The text was updated successfully, but these errors were encountered: