arne-bdt commented on issue #2787:
URL: https://github.com/apache/jena/issues/2787#issuecomment-2434904563

   Due to the complexity of the initialization process and the presence of 
circular dependencies, resolving the deadlock issue is not straightforward. If 
we can't clean up the initialization process and eliminate these circular 
dependencies, we're essentially left with two problematic variants:
   
   1. **NullPointerException (NPE)** (prior to the 
https://github.com/apache/jena/commit/8654c07f23a892c03a7367981d814c3c8b094f62 
change): If the user forgets to call JenaSystem.init() from a single-threaded 
context before using the library in a multithreaded environment, the 
application may encounter a NullPointerException. This can occur because 
certain components of the library remain uninitialized, leading to unexpected 
null references when accessed by multiple threads.
   
   2. **Deadlock** (since Jena 5.2.0): Alternatively, if the library is used in 
a multithreaded context without proper initialization, a deadlock may occur due 
to threads waiting on class initialization locks and synchronized methods. This 
is particularly difficult to diagnose because the application may simply hang 
without any clear indication of the cause.
   
   For the **Deadlock** variant, I implemented a fail-fast approach that throws 
an informative exception. (See update in [PR 
#2792](https://github.com/apache/jena/pull/2792).)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to