mirror of
https://github.com/jetty/jetty.project.git
synced 2025-02-20 21:58:33 +00:00
* Fixed deadlock in class initialization. (#10540) * Thread T1 may initialize HttpTester.Message that extends MutableHttpFields, so grabs the lock for the initialization of class MutableHttpFields. * Thread T2 may initialize HttpFields, so grabs the lock for HttpFields and initializes field EMPTY, which calls new MutableHttpFields. * To initialize MutableHttpFields, T1 must initialize HttpFields, but sees that its lock is taken and waits. * To initialize HttpFields, T2 must create an instance and therefore initialize MutableHttpFields, but sees that its lock is taken and waits. * Deadlock. The solution is to use another class, EmptyHttpFields, to initialize HttpFields.EMPTY, so that there is no deadlock. Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com> Co-authored-by: Simone Bordet <simone.bordet@gmail.com>