Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 6.1.21
-
Fix Version/s: 6.1.23
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
In the following line:
private transient int _state = STOPPED;
in this file:
jetty-6.1.22/modules/util/src/main/java/org/mortbay/component/AbstractLifeCycle.java
the 'transient' should very likely be 'volatile'.
I do not consider this a minor issue since it can actually prevent Jetty from starting up. Consider the following chain of events:
These kinds of concurrency bugs are starting to show up on modern multi-core machines and JVMs.
- Inside Acceptor.run() the method isRunning() is called, which returns false. This is because the '_state' field is not volatile and thus the new thread still sees it as 'STOPPED' even though the other thread sees it as 'STARTING. The Acceptor thread thus immediately exists and closes its socket which obviously is very undesirable.
These kinds of concurrency bugs are starting to show up on modern multi-core machines and JVMs.