-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Issue #5088 Review ContextHandler locking #5094
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
Conversation
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.
@@ -1805,7 +1805,7 @@ public void setMetaData(org.eclipse.jetty.http.MetaData.Request request) | |||
} | |||
else if (encoded.startsWith("/")) | |||
{ | |||
path = (encoded.length() == 1) ? "/" : URIUtil.canonicalPath(URIUtil.decodePath(encoded)); | |||
path = (encoded.length() == 1) ? "/" : URIUtil.canonicalPath(uri.getDecodedPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops this is an unrelated change that accidentally slipped in.
The uri.getDecodedPath()
method does exactly URIUtil.decodePath(encoded)
, but caches the results so they can be reused if needed again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be done in 9 or 10? We are changing the signature of exposed methods, albeit only via removal of the "synchronized" keyword, but tooling may flag this as an api compatibility problem for a point release?
jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Show resolved
Hide resolved
@@ -230,10 +231,10 @@ public static void setServerInfo(String serverInfo) | |||
|
|||
public enum Availability | |||
{ | |||
UNAVAILABLE, STARTING, AVAILABLE, SHUTDOWN, | |||
STOPPED, STARTING, AVAILABLE, UNAVAILABLE, SHUTDOWN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a comment about the meanings of the different states, particularly UNAVAILABLE vs STOPPED, which is a new state.
// canonicalPath() is not responsible for decoding characters | ||
{"/foo/.;/bar", "/foo/.;/bar"}, | ||
{"/foo/..;/bar", "/foo/..;/bar"}, | ||
{"/foo/..;/..;/bar", "/foo/..;/..;/bar"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, see note explaining it above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no it's another unrelated change! Double ooops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep - my bad!
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.