Skip to content
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

Build up of ConstraintMappings when stopping and starting WebAppContext #5824

Closed
lachlan-roberts opened this issue Dec 18, 2020 · 4 comments · Fixed by #5842
Closed

Build up of ConstraintMappings when stopping and starting WebAppContext #5824

lachlan-roberts opened this issue Dec 18, 2020 · 4 comments · Fixed by #5842
Assignees

Comments

@lachlan-roberts
Copy link
Contributor

Jetty version
10.0.x

Description
After calling stop() then start() a bunch of times on a WebAppContext, I get a build up of constraint mappings.
Here is a section of a dump I took showing the ConstraintMappings, I improved the toString of ConstraintMapping in my local code to get extra info on the mappings.

+= org.eclipse.jetty.server.session.SessionHandler1764291958==dftMaxIdleSec=1800 - STARTED
|  += ConstraintSecurityHandler@45c8d09f{STARTED} - STARTED
...
|  |  +> constraints size=1
|  |     +> java.util.concurrent.CopyOnWriteArrayList@c2a36b28(size=12)
|  |        +: ConstraintMapping25e2a451{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping53812a9b{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
|  |        +: ConstraintMapping4c3937b5{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping36d93000{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
|  |        +: ConstraintMapping1f56b6bd{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping8a52f2d{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
|  |        +: ConstraintMapping53b63709{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping576c0759{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
|  |        +: ConstraintMapping12fbc963{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping3c589122{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
|  |        +: ConstraintMapping431830b3{pathSpec=/, constraint=SC{Disable TRACE,[],DC_UNSET}}
|  |        +: ConstraintMapping74f9b146{pathSpec=/, constraint=SC{Enable everything but TRACE,-,DC_UNSET}}
@janbartel
Copy link
Contributor

@lachlan-roberts did you specify a ConstraintSecurityHandler in a context xml or code equivalent, or did you let jetty create it for you on startup?

@janbartel janbartel self-assigned this Dec 23, 2020
@janbartel janbartel added this to To do in Jetty 9.4.36 via automation Dec 23, 2020
@janbartel
Copy link
Contributor

This is applicable for jetty-9.4 as well.

ConstraintMappings are never cleared out of the ConstraintSecurityHandler, thus if they were added via a web.xml/web-fragment.xml, annotation or javax.servlet api call, they will be duplicated when the context restarts.

Note that this generally isn't a problem when running in the distro, as the deployer removes the WebAppContext and creates a fresh one when it restarts the webapp. Embedded code or the jetty-maven-plugin would be affected though.

The problem seems to have been there since 2012 with the following commit: 1d89bef

janbartel added a commit that referenced this issue Dec 23, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel janbartel linked a pull request Dec 23, 2020 that will close this issue
@janbartel
Copy link
Contributor

Opened PR #5842

janbartel added a commit that referenced this issue Dec 23, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Dec 24, 2020
…dler start

Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Dec 30, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Dec 30, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Jan 11, 2021
* Issue #5824 Durable ConstraintMappings.

Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor

Fixed by PR #5842

Jetty 9.4.36 automation moved this from To do to Done Jan 11, 2021
This was referenced Mar 10, 2021
This was referenced Mar 10, 2021
cstamas pushed a commit to cstamas/jetty.project that referenced this issue Nov 26, 2021
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants