Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: Simone Bordet <[email protected]>
- Loading branch information