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
PropertyNamingStrategy
class initialization depends on its subclass, this can lead to class loading deadlock
#2715
Comments
Interesting. Thank you for reporting this, sounds like a potentially severe issue. Do you know version of Jackson problem was encountered with? (AWS jdk core used relatively old version last I checked, 2.6.7?, but that was a while ago). |
Also... may be really really difficult to actually resolve, wrt backwards compatibility problems. |
As a workarround, we can change the code of aws-java-sdk-core, |
@fangwentong Yes. I think for databind itself, will probably need to introduce something like |
OK, thanks, backwards compatibility is really important,I'll create a PR to |
bypass the potential deadlock when PropertyNamingStrategy class initialization see: FasterXML/jackson-databind#2715
bypass the potential deadlock when PropertyNamingStrategy class initialization see: FasterXML/jackson-databind#2715
Unfortunately I think the solution can only go in 2.12, as I need to add |
PropertyNamingStrategy
class initialization depends on its subclass, this can lead to class loading deadlock
Also replaced Jackson's PropertyNamingStrategy deprecation: FasterXML/jackson-databind#2715
…akeCaseStrategy This has been replaced by PropertyNamingStrategies.SnakeCaseStrategy due to a possible classloader deadlock: FasterXML/jackson-databind#2715
…3634) This has been replaced by `PropertyNamingStrategies.SnakeCaseStrategy` due to a possible class loader deadlock. Refs FasterXML/jackson-databind#2715
…3634) This has been replaced by `PropertyNamingStrategies.SnakeCaseStrategy` due to a possible class loader deadlock. Refs FasterXML/jackson-databind#2715 (cherry picked from commit 710c9a7)
Problem In release 2.12, Jackson introduced `PropertyNamingStrategies` as a work-around for [#2715](FasterXML/jackson-databind#2715) which deprecated using the like `PropertyNamingStrategy` static fields. Solution Move to using the equivalent static fields in `PropertyNamingStrategies`. Result Less deprection tech-debt. Differential Revision: https://phabricator.twitter.biz/D838232
… (#3634) This has been replaced by `PropertyNamingStrategies.SnakeCaseStrategy` due to a possible class loader deadlock. Refs FasterXML/jackson-databind#2715
…ropertyNamingStrategy$SnakeCaseStrategy PropertyNamingStrategy.SnakeCaseStrategy is used but it has been deprecated due to risk of deadlock. Consider using PropertyNamingStrategies.SnakeCaseStrategy instead. See FasterXML/jackson-databind#2715 for more details.
If a class refer to its subclasses in its static initializers or in static fields, this references can cause JVM-level deadlocks in multithreaded environment, when one thread tries to load superclass and another thread tries to load subclass at the same time.
See: https://bugs.openjdk.java.net/browse/JDK-8037567
The following demo code can reproduce this deadlock
When the demo program
ClassInitDeadLock
started, it could not exit automatically.Thread-A
holdingPropertyNamingStrategy
class , and waitingPascalCaseStrategy
class initialize, whileThread-B
holdingPascalCaseStrategy
class, and waitingPropertyNamingStrategy
class initialize, deadlock occurred!jstack of these two thread:
In the actual environment,
PropertyNamingStrategy
and its subclass defined in jackson-databind initialize very fast, so It's hard to produce the scene that multithread load superclass and subclass at the same time.I happened to meet this deadlock recently, It turn out to be JsonErrorUnmarshaller.java#L37 defined in
aws-java-sdk-core
, trying to initialize subclassPascalCaseStrategy
, at the same time, another thread is initilizing superclassPropertyNamingStrategy
The text was updated successfully, but these errors were encountered: