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

ServletChannel now using proper state changes for calls to ErrorHandler to avoid IllegalStateExceptions #10384

Closed
gregw opened this issue Aug 24, 2023 · 1 comment · Fixed by #10930
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@gregw
Copy link
Contributor

gregw commented Aug 24, 2023

Jetty version(s)
12

Jetty Environment
ee10

Description

[INFO] Running org.eclipse.jetty.ee10.proxy.AsyncMiddleManServletTest
https://jenkins.webtide.net/blue/rest/organizations/jenkins/pipelines/jetty.project/branches/jetty-12.0.x/runs/1451

2023-08-22 21:35:51.054:INFO :oejs.AbstractConnector:ForkJoinPool-1-worker-2: Started ServerConnector@349b6a83{HTTP/1.1, (http/1.1)}{0.0.0.0:46705}
2023-08-22 21:35:51.054:INFO :oejs.Server:ForkJoinPool-1-worker-2: Started oejs.Server@5cc9c47f{STARTING}[12.0.1-SNAPSHOT,sto=0] @5482ms
2023-08-22 21:35:52.057:INFO :oejepA.a289c7:proxy-994: Exception while transforming org.eclipse.jetty.ee10.proxy.AsyncMiddleManServletTest$16$1@24120067 : java.lang.NullPointerException: explicitly_thrown_by_test
2023-08-22 21:35:52.059:WARN :oejut.QueuedThreadPool:proxy-996: Job failed
java.lang.IllegalStateException: s=HANDLING rs=BLOCKING os=OPEN is=IDLE awp=false se=false i=false al=0
	at org.eclipse.jetty.ee10.servlet.ServletChannelState.handling(ServletChannelState.java:357)
	at org.eclipse.jetty.ee10.servlet.ServletChannel.handle(ServletChannel.java:462)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.run(ContextHandler.java:1267)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.run(ContextHandler.java:1254)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.lambda$execute$0(ContextHandler.java:1279)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
	at java.base/java.lang.Thread.run(Thread.java:1583)
2023-08-22 21:35:52.060:INFO :oejs.Server:ForkJoinPool-1-worker-2: Stopped oejs.Server@5cc9c47f{STOPPING}[12.0.1-SNAPSHOT,sto=0]
2023-08-22 21:35:52.061:INFO :oejs.AbstractConnector:ForkJoinPool-1-worker-2: Stopped ServerConnector@349b6a83{HTTP/1.1, (http/1.1)}{0.0.0.0:0}
2023-08-22 21:35:52.062:INFO :oejes.ServletContextHandler:ForkJoinPool-1-worker-2: Stopped oeje10s.ServletContextHandler@723c2f0c{ROOT,/,b=null,a=AVAILABLE,h=oeje10s.SessionHandler@60cac15{STOPPED}}
2023-08-22 21:35:52.062:INFO :oejs.Server:ForkJoinPool-1-worker-2: Stopped oejs.Server@48a2d94f{STOPPING}[12.0.1-SNAPSHOT,sto=0]
2023-08-22 21:35:52.063:INFO :oejs.AbstractConnector:ForkJoinPool-1-worker-2: Stopped ServerConnector@44394f59{HTTP/1.1, (http/1.1)}{0.0.0.0:0}
2023-08-22 21:35:52.063:INFO :oejes.ServletContextHandler:ForkJoinPool-1-worker-2: Stopped oeje10s.ServletContextHandler@6d0c0b96{ROOT,/,b=null,a=AVAILABLE,h=oeje10s.SessionHandler@2f38cb3b{STOPPED}}
2023-08-22 21:35:52.069:WARN :oejsi.HttpConnection:server-986: reset failed SendCallback@7dec8705[CLOSED][i=null,cb=null]
2023-08-22 21:35:52.070:WARN :oejut.SerializedInvoker:server-986: Serialized invocation error
java.util.concurrent.RejectedExecutionException: org.eclipse.jetty.server.handler.ContextHandler$ScopedContext$$Lambda/0x00000007c0346738@60cc2c5
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool.execute(QueuedThreadPool.java:770)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.Server$ServerContext.execute(Server.java:901)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.execute(ContextHandler.java:1279)
	at org.eclipse.jetty.ee10.servlet.ServletChannel.execute(ServletChannel.java:853)
	at org.eclipse.jetty.ee10.servlet.ServletChannelState.scheduleDispatch(ServletChannelState.java:1079)
	at org.eclipse.jetty.ee10.servlet.ServletChannel.lambda$handle$0(ServletChannel.java:542)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.Callback$4.completed(Callback.java:211)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.Callback$Completing.failed(Callback.java:384)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.Callback$Nested.failed(Callback.java:429)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextHandler$ScopedContext.accept(ContextHandler.java:1242)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.handler.ContextResponse$1.failed(ContextResponse.java:47)
	at org.eclipse.jetty.server@12.0.1-SNAPSHOT/org.eclipse.jetty.server.internal.HttpChannelState$ChannelResponse.lambda$write$1(HttpChannelState.java:1262)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.SerializedInvoker$Link.run(SerializedInvoker.java:191)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
	at org.eclipse.jetty.util@12.0.1-SNAPSHOT/org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
	at java.base/java.lang.Thread.run(Thread.java:1583)
2023-08-22 21:35:52.075:INFO :oejs.Server:ForkJoinPool-1-worker-2: jetty-12.0.1-SNAPSHOT; built: 2023-08-22T21:15:43.448Z; git: a51c67dbb4d6f78dc8dc7cbca6997b19308dec65; jvm 21-ea+32-2482
2023-08-22 21:35:52.077:INFO :oejs.DefaultSessionIdManager:ForkJoinPool-1-worker-2: Session workerName=node0
@gregw gregw added the Bug For general bugs on Jetty side label Aug 24, 2023
@joakime joakime removed this from Jetty 12.0.3 Oct 11, 2023
sbordet added a commit that referenced this issue Nov 27, 2023
…est.

Reworked the ServletChannel.handle() SEND_ERROR case.
Now using the proper state changes to call ErrorHandler.handle(), which is asynchronous, so that IllegalStateExceptions are avoided.

Restored idle timeout tests in ee9/ee10 AsyncMiddleManServletTest.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet moved this to 🏗 In progress in Jetty 12.0.4 - FROZEN Nov 27, 2023
sbordet added a commit that referenced this issue Nov 29, 2023
…s to ErrorHandler to avoid IllegalStateExceptions (#10930)

Reworked the ServletChannel.handle() SEND_ERROR case.
Now using the proper state changes to call ErrorHandler.handle(), which is asynchronous, so that IllegalStateExceptions are avoided.

Restored idle timeout tests in ee9/ee10 AsyncMiddleManServletTest.

Fixed notification of request destroyed in ErrorHandler: must be before completing the callback, since listener may call Servlet APIs that should see the ServletChannel state before the ErrorHandler callback changes it.
Updated ServletChannelState.isAsync() and isAsyncStarted().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet
Copy link
Contributor

sbordet commented Nov 29, 2023

Fixed by #10930.

@sbordet sbordet closed this as completed Nov 29, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Jetty 12.0.4 - FROZEN Nov 29, 2023
@joakime joakime changed the title Unsuppressed exceptions in EE10 AsyncMiddleManServletTest ServletChannel now using proper state changes for calls to ErrorHandler to avoid IllegalStateExceptions Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
No open projects
Status: ✅ Done
2 participants