-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Review ContextHandler locking #5088
Comments
I vote that Changing the classloader after some classes have been loaded cannot lead to good things. |
gregw
added a commit
that referenced
this issue
Jul 29, 2020
The locking was primarily as a memory guard for the availability status, which was already volatile. Have instead using an AtomicReference with a simple state machine layered on top of start/stop lifecycle. There was also protection for AttributesMap, which is no longer needed as AttributesMap is now concurrent.
gregw
added a commit
that referenced
this issue
Jul 29, 2020
gregw
added a commit
that referenced
this issue
Jul 30, 2020
gregw
added a commit
that referenced
this issue
Jul 30, 2020
* Issue #5088 Review ContextHandler locking The locking was primarily as a memory guard for the availability status, which was already volatile. Have instead using an AtomicReference with a simple state machine layered on top of start/stop lifecycle. There was also protection for AttributesMap, which is no longer needed as AttributesMap is now concurrent. * Issue #5088 updates from review * Issue #5088 updates from review (better this time)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Spawned by #5083.
Jetty version
9.4.x
Description
ContextHandler
uses a mix ofsynchronized
modifiers andsynchronized (this)
inside methods that is difficult to reconcile.Furthermore, it has a
setClassLoader()
method that allow to arbitrarily change the_classLoader
field but the rest of the code does not protect with a lock this field, nor it reads the field only once.For example,
loadClass()
,handle()
,addListener()
, etc. reference the_classLoader
field multiple times and the field may change between the references.Also,
handle()
could have an improved logic.In
handle()
, in thefinally
block, rather than checking onoldClassLoader
the check should be done symmetrically on_classLoader
like the code before thetry
does and likedoStart()
does.Also,
setAvailable()
is locked, butisAvailable()
is not. In general,_availability
is not correctly locked.The text was updated successfully, but these errors were encountered: