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

Initial work for Cross Context Dispatch testing suite #11886

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Jun 6, 2024

Cross Context Dispatch testing suite across multiple Jetty EE Environments.

This replaces PR #11885

@joakime joakime added the Test label Jun 6, 2024
@joakime joakime requested a review from janbartel June 6, 2024 19:41
@joakime joakime self-assigned this Jun 6, 2024
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting solution to write the test infrastructure!

// ========================================================================
//

package org.eclipse.jetty.tests.ccd.common;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this class be a record instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our json lib didn't like that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must say something about the age of the json library :)


package org.eclipse.jetty.tests.ccd.common;

public interface Step
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fashion these days appears to be to put any abstract classes and any impls in the same package inside of the interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems noisy for no good reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at the Handler class. I'm just getting in with this before Simone or Greg do :)

import org.eclipse.jetty.tests.ccd.common.steps.GetHttpSessionStep;
import org.eclipse.jetty.tests.ccd.common.steps.RequestDispatchStep;

public class CCDServlet extends HttpServlet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible to use the ee9 -> ee8 translation maven plugin to auto generate the classes, might want to consider that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No benefit for that.
First, this ccd-ee8-webapp is actually different than the ccd-ee9-webapp.
Also, there's no jetty-ee8 dependencies in this webapp for the translation plugin to work against.
It's a webapp, with jetty-core deps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can easily be translated from the ccd-ee9-webapp to replace jakarta.servlet. with javax.servlet. Also I think both the ee8 and ee9 tests should do the same object wrapper identity test, so the code should be identical anyway.

},
"steps": [
{
"class": "org.eclipse.jetty.tests.ccd.common.steps.ContextRedispatchStep",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as testing a straight Forward and Include (and then return) between ee8, ee9, ee10, I'd like us to also test the slightly more complex scenarios of :
Forward -> Forward -> return , Forward -> Include -> return , Include -> Forward -> return, Include -> Include -> return across ee8, ee9, ee10 and soon ee11.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Can do.
There's many options we can wire up with this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need a test that does:

eeX creates a session, forwards to eeY, which creates a session, returns back to eeX, then eeX forwards again to eeY. Need to check that eeY finds the same session it previously created. We also need to check (somehow) that all sessions are correctly completed during the return from dispatch chain.

"org.eclipse.jetty.tests.ccd.ee10.CCDServlet.service() dispatcherType=REQUEST method=GET requestUri=/ccd-ee10/redispatch/ee10",
"org.eclipse.jetty.tests.ccd.ee10.DumpServlet.service() dispatcherType=FORWARD method=GET requestUri=/ccd-ee10/dump/ee10"
],
"expectedProperties": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also want to test that if the jakarta.servlet.forward.* or jakarta.servlet.include.* attributes are requested in an ee9 and above context that originated from an dispatch from an ee8 context, that the correct values are returned (which would have been javax.servlet.forward.* or javax.servlet.include.* in the original ee8 context).

Similarly, if an ee9 context does a dispatch to an ee8 context, the ee8 context should be able to see the dispatch attributes with a prefix of javax.servlet instead of jakarta.servlet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, those properties are present.

For example, the properties on this one are reported as ...

dispatchPlan.event[0]=Initial plan: context-ee10-forward-dump.json
dispatchPlan.event[1]=DispatchPlanHandler.handle() method=GET path-query=/ccd-ee10/redispatch/ee10
dispatchPlan.event[2]=org.eclipse.jetty.tests.ccd.ee10.CCDServlet.service() dispatcherType=REQUEST method=GET requestUri=/ccd-ee10/redispatch/ee10
dispatchPlan.event[3]=org.eclipse.jetty.tests.ccd.ee10.DumpServlet.service() dispatcherType=FORWARD method=GET requestUri=/ccd-ee10/dump/ee10
dispatchPlan.events.count=4
request.attr[jakarta.servlet.forward.context_path]=/ccd-ee10
request.attr[jakarta.servlet.forward.mapping]=ServletPathMapping{mappingMatch=PATH, matchValue=redispatch, pattern=/redispatch/*, servletName=ccd, servletPath=/redispatch, pathInfo=/ee10}
request.attr[jakarta.servlet.forward.path_info]=/ee10
request.attr[jakarta.servlet.forward.query_string]=<null>
request.attr[jakarta.servlet.forward.request_uri]=/ccd-ee10/redispatch/ee10
request.attr[jakarta.servlet.forward.servlet_path]=/redispatch
request.attr[org.eclipse.jetty.server.Request.Cookies]=[]
request.attr[org.eclipse.jetty.server.Request.maxFormContentSize]=200000
request.attr[org.eclipse.jetty.server.Request.maxFormKeys]=1000
request.attr[org.eclipse.jetty.tests.ccd.common.DispatchPlan]=DispatchPlan[id=context-ee10-forward-dump.json]
request.authType=<null>
request.characterEncoding=<null>
request.contentLength=-1
request.contentType=<null>
request.contextPath=/ccd-ee10
request.dispatcherType=FORWARD
request.header[Accept-Encoding]=gzip
request.header[Host]=localhost:33753
request.header[User-Agent]=Jetty/12.0.11-SNAPSHOT
request.header[X-DispatchPlan]=context-ee10-forward-dump.json
request.localAddr=127.0.0.1
request.localName=127.0.0.1
request.localPort=33753
request.locale=en_US
request.method=GET
request.pathInfo=/ee10
request.pathTranslated=<null>
request.protocol=HTTP/1.1
request.queryString=<null>
request.remoteAddr=127.0.0.1
request.remoteHost=127.0.0.1
request.remotePort=45628
request.remoteUser=<null>
request.requestURI=/ccd-ee10/dump/ee10
request.requestURL=http://localhost:33753/ccd-ee10/dump/ee10
request.requestedSessionId=<null>
request.serverPort=33753
request.servletPath=/dump

],
"expectedProperties": [
{
"class": "org.eclipse.jetty.tests.ccd.common.Property",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to be able to test object wrapper identity (see #11888). So we need a test that wraps the request before the dispatch, and inside the dispatch target we see exactly the same object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's done in a different testcase right now.

See RedispatchTests.testEe8FilterWithAwkwardRequestURI()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that test is actually testing object wrapper identity with an == but rather inferring it: I think Greg has said he'd like to see an actual instance equality test.

* {@link HttpServletRequest#getRequestURI()} to something that does
* not satisfy the Servlet spec URI invariant {@code request URI == context path + servlet path + path info}
*/
public class InternalRequestURIFilter implements Filter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this attempting to test the object wrapper identity that I mentioned in a subsequent comment? If so I think we need a different test that checks exact object equality.

import org.eclipse.jetty.tests.ccd.common.steps.GetHttpSessionStep;
import org.eclipse.jetty.tests.ccd.common.steps.RequestDispatchStep;

public class CCDServlet extends HttpServlet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can easily be translated from the ccd-ee9-webapp to replace jakarta.servlet. with javax.servlet. Also I think both the ee8 and ee9 tests should do the same object wrapper identity test, so the code should be identical anyway.

@joakime joakime marked this pull request as ready for review June 11, 2024 22:55
@joakime
Copy link
Contributor Author

joakime commented Jun 12, 2024

@janbartel here's that stacktrace you were asking about.

2024-06-11 19:26:22.649:INFO :oejtt.ProcessWrapper:process/err: 2024-06-11 19:26:22.647:WARN :oejen.HttpChannel:qtp103887628-45: /ccd-ee9/redispatch/ee9
2024-06-11 19:26:22.649:INFO :oejtt.ProcessWrapper:process/err: jakarta.servlet.ServletException: java.lang.IllegalStateException: s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0
2024-06-11 19:26:22.649:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.CrossContextDispatcher.forward(CrossContextDispatcher.java:261)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee9.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1397)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHolder.handle(ServletHolder.java:765)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHandler.doHandle(ServletHandler.java:528)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.handle(ScopedHandler.java:127)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.security.SecurityHandler.handle(SecurityHandler.java:622)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HandlerWrapper.handle(HandlerWrapper.java:124)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextHandle(ScopedHandler.java:197)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.SessionHandler.doHandle(SessionHandler.java:476)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextHandle(ScopedHandler.java:195)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.doHandle(ContextHandler.java:1034)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:164)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHandler.doScope(ServletHandler.java:483)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:162)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.SessionHandler.doScope(SessionHandler.java:470)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:162)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.doScope(ContextHandler.java:955)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.handle(ScopedHandler.java:125)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.handle(ContextHandler.java:1693)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1575)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel.dispatch(HttpChannel.java:737)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel.handle(HttpChannel.java:510)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler$CoreContextHandler$CoreToNestedHandler.handle(ContextHandler.java:2727)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.CrossContextDispatcher.forward(CrossContextDispatcher.java:236)
2024-06-11 19:26:22.650:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee8.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1146)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHolder.handle(ServletHolder.java:640)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHandler.doHandle(ServletHandler.java:456)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.handle(ScopedHandler.java:119)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.security.SecurityHandler.handle(SecurityHandler.java:511)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HandlerWrapper.handle(HandlerWrapper.java:108)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextHandle(ScopedHandler.java:183)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.SessionHandler.doHandle(SessionHandler.java:404)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextHandle(ScopedHandler.java:181)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.doHandle(ContextHandler.java:878)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:152)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHandler.doScope(ServletHandler.java:423)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:150)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.SessionHandler.doScope(SessionHandler.java:399)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:150)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.doScope(ContextHandler.java:823)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.handle(ScopedHandler.java:117)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.handle(ContextHandler.java:1421)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1293)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel.dispatch(HttpChannel.java:623)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel.handle(HttpChannel.java:455)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextHandler$CoreToNestedHandler.handle(ContextHandler.java:2257)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.CrossContextDispatcher.forward(CrossContextDispatcher.java:233)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee10.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1370)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:736)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1614)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler$MappedServlet.handle(ServletHandler.java:1547)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletChannel.dispatch(ServletChannel.java:824)
2024-06-11 19:26:22.651:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:436)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler.handle(ServletHandler.java:464)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.SessionHandler.handle(SessionHandler.java:703)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:181)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.Handler$Wrapper.handle(Handler.java:740)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.common.DispatchPlanHandler.handle(DispatchPlanHandler.java:75)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.Server.handle(Server.java:181)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:635)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:403)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at java.base/java.lang.Thread.run(Thread.java:833)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: Caused by: 
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: java.lang.IllegalStateException: s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=true al=0
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannelState.recycle(HttpChannelState.java:868)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.Request.recycle(Request.java:1396)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel.recycle(HttpChannel.java:417)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextHandler.wrapRequest(ContextHandler.java:2211)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:837)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.CrossContextDispatcher.forward(CrossContextDispatcher.java:256)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee9.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1397)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHolder.handle(ServletHolder.java:765)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHandler.doHandle(ServletHandler.java:528)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.handle(ScopedHandler.java:127)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.security.SecurityHandler.handle(SecurityHandler.java:622)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HandlerWrapper.handle(HandlerWrapper.java:124)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextHandle(ScopedHandler.java:197)
2024-06-11 19:26:22.652:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.SessionHandler.doHandle(SessionHandler.java:476)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextHandle(ScopedHandler.java:195)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.doHandle(ContextHandler.java:1034)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:164)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.servlet.ServletHandler.doScope(ServletHandler.java:483)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:162)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.SessionHandler.doScope(SessionHandler.java:470)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.nextScope(ScopedHandler.java:162)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.doScope(ContextHandler.java:955)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ScopedHandler.handle(ScopedHandler.java:125)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler.handle(ContextHandler.java:1693)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1575)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel.dispatch(HttpChannel.java:737)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.HttpChannel.handle(HttpChannel.java:510)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee9.nested.ContextHandler$CoreContextHandler$CoreToNestedHandler.handle(ContextHandler.java:2727)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.CrossContextDispatcher.forward(CrossContextDispatcher.java:236)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee8.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1146)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHolder.handle(ServletHolder.java:640)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHandler.doHandle(ServletHandler.java:456)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.handle(ScopedHandler.java:119)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.security.SecurityHandler.handle(SecurityHandler.java:511)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HandlerWrapper.handle(HandlerWrapper.java:108)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextHandle(ScopedHandler.java:183)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.SessionHandler.doHandle(SessionHandler.java:404)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextHandle(ScopedHandler.java:181)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.doHandle(ContextHandler.java:878)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:152)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.servlet.ServletHandler.doScope(ServletHandler.java:423)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:150)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.SessionHandler.doScope(SessionHandler.java:399)
2024-06-11 19:26:22.653:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.nextScope(ScopedHandler.java:150)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.doScope(ContextHandler.java:823)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ScopedHandler.handle(ScopedHandler.java:117)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler.handle(ContextHandler.java:1421)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1293)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel.dispatch(HttpChannel.java:623)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.HttpChannel.handle(HttpChannel.java:455)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee8.nested.ContextHandler$CoreContextHandler$CoreToNestedHandler.handle(ContextHandler.java:2257)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.CrossContextDispatcher.forward(CrossContextDispatcher.java:233)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.ee10.CCDServlet.service(CCDServlet.java:58)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1370)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHolder.handle(ServletHolder.java:736)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1614)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler$MappedServlet.handle(ServletHandler.java:1547)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletChannel.dispatch(ServletChannel.java:824)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:436)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.ServletHandler.handle(ServletHandler.java:464)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.ee10.servlet.SessionHandler.handle(SessionHandler.java:703)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:851)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:181)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.Handler$Wrapper.handle(Handler.java:740)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.tests.ccd.common.DispatchPlanHandler.handle(DispatchPlanHandler.java:75)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.Server.handle(Server.java:181)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.internal.HttpChannelState$HandlerInvoker.run(HttpChannelState.java:635)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.server.internal.HttpConnection.onFillable(HttpConnection.java:403)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:322)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:99)
2024-06-11 19:26:22.654:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
2024-06-11 19:26:22.655:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:979)
2024-06-11 19:26:22.655:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1209)
2024-06-11 19:26:22.655:INFO :oejtt.ProcessWrapper:process/err: ?at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1164)
2024-06-11 19:26:22.655:INFO :oejtt.ProcessWrapper:process/err: ?at java.base/java.lang.Thread.run(Thread.java:833)

@janbartel
Copy link
Contributor

@joakime I've merged your branch into the https://github.com/jetty/jetty.project/tree/jetty-12.0.x-object-identity-ee8-and-ee9 so I can do some testing. It helped me find the bug that was causing the stacktrace you posted earlier!

@janbartel janbartel self-requested a review June 13, 2024 00:11
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments to address before we check this into head. Also, I don't see the object identity test? That's an important one to have from the get-go.

}
else if (step instanceof Step.HttpSessionSetAttribute sessionSetAttribute)
{
HttpSession session = req.getSession(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm putting this comment on the ee10 CCDServlet, but it goes for all the others as well. I think each step needs to generate a dispatchPlan.addEvent. I was just following through the event output from one of the tests and I got confused as it looked like there was a "HttpSession exists: null" where it shouldn't be, but then I realized that the HttpSetSessionAttribute step doesn't generate an event output. I think its important for consistency and comprehensibility that every step generates at least 1 event output.

For extra credit, it might be nice to put the generation of those events inside the Step itself, so each servlet doesn't haven't to do so much boilerplate code (with the possibility of making errors), so something like:

interface Step
{
   void addEvent(DispatchPlan plan, String... args);
}


class GetHttpSession extends AbstractStep
{

    public void addEvent(DispatchPlan plan, String... args)
    {
        plan.addEvent("%s.service() HttpSession exists: [%s]=[%s]",
                        args[0],
                        args[1],
                        args[2]
    }
}

so then the CCDServlets code becomes:

   step.addEvent(
                        dispatchPlan,
                        this.getClass().getName(),
                        name,
                        Objects.toString(value));

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PlanSessionCache extends DefaultSessionCache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about why this is necessary

import java.util.List;
import java.util.concurrent.LinkedBlockingDeque;

public class DispatchPlan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc


import java.util.Map;

public class HttpRequest implements Step
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc

// we should have the commit() and release() for each new Session.
for (String sessionId : newSessions)
{
assertThat(logEntries, hasItem("SessionCache.event.commit()=" + sessionId));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a race condition here - I think that the log might not be finished being written by the time you're looking at the output, as I see tests of these session contents failing randomly, even though the log contains the correct information. So you need to use Awaitility to wait a bit. Have a look for example at https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-sessions/jetty-ee9-test-sessions-common/src/test/java/org/eclipse/jetty/ee9/session/CreationTest.java#L157

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test suite we cannot dig down into a class in one of the EE# environments (we don't have access to it).
We don't even have access to that JVM for waiting on the Server instance, as it's a forked JVM.
That means we have no test we can give Awaitility.

The best we can do is setup graceful shutdown and wait on the JVM closing via the JettyHomeTester.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All you need to do is to wait until the session.log file is no longer being written to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All you need to do is to wait until the session.log file is no longer being written to.

That's not a state check you can do from a different process (pid).
Keep in mind we are dealing with a forked JVM.

Waiting for the forked JVM to exit seems like the only event we can use.

@janbartel janbartel self-requested a review June 19, 2024 02:43
janbartel
janbartel previously approved these changes Jun 19, 2024
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put the javadocs in I requested before you merge this please.

@joakime joakime force-pushed the fix/12.0.x/cross-context-testing-2 branch from 044b9d9 to 7011827 Compare June 19, 2024 15:13
@joakime joakime merged commit 422d73d into jetty-12.0.x Jun 19, 2024
10 checks passed
@joakime joakime deleted the fix/12.0.x/cross-context-testing-2 branch June 19, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants