You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2020/04/18 14:24:40 UTC

[Bug 64366] New: [sse] NPE while closing async http/2 connector

https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

            Bug ID: 64366
           Summary: [sse] NPE while closing async http/2 connector
           Product: Tomcat 9
           Version: 9.0.34
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: claude@renegat.net
  Target Milestone: -----

Seen in the log while closing normally the webapp and the container with
'systemctl stop tomcat9'

INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping
ProtocolHandler ["https-openssl-apr-443"]
SEVERE [https-openssl-apr-443-exec-171]
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch
       Exception while processing an asynchronous request
        java.lang.NullPointerException
                at
org.apache.coyote.http11.filters.ChunkedOutputFilter.end(ChunkedOutputFilter.java:164)
                at
org.apache.coyote.http11.Http11OutputBuffer.end(Http11OutputBuffer.java:231)
                at
org.apache.coyote.http11.Http11Processor.finishResponse(Http11Processor.java:1133)
                at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:385)
                at org.apache.coyote.Response.action(Response.java:209)
                at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:261)
                at
org.apache.catalina.connector.Response.finishResponse(Response.java:441)
                at
org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:245)
                at
org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:237)
                at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59)
                at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
                at
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:1998)
                at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
                at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
                at java.lang.Thread.run(Thread.java:748)

I suspect it's linked to the fact that the webapp uses an event-stream
datasource.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #8 from Claude Brisson <cl...@renegat.net> ---
Makes sense.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
Just a gentle reminder than we need the steps to re-create this issue as local
testing generates what appears to be a reasonable error message.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEEDINFO                    |RESOLVED

--- Comment #7 from Mark Thomas <ma...@apache.org> ---
I've dropped the sleep to zero and I still haven't seen this error. I have seen
various other similar errors though.

There are likely to be many, many code paths that will trigger different
exceptions. In each case the first indication of a problem is the following log
message:

01-May-2020 17:39:34.570 WARNING [Thread-4]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web
application [tomcat-bugs] appears to have started a thread named [Thread-5] but
has failed to stop it. This is very likely to create a memory leak. Stack trace
of thread:

Note that the name of the thread that has not been stopped is given in the
above message.

What then follows is:

Exception in thread "Thread-5" ...<1 of various exceptions>

Note that the various exceptions will occur on the thread that hasn't been
stopped. Therefore, I consider the first warning message sufficient explanation
for the following exception(s). I do not think that the effort required to
provide "better" messages in those cases is justified as determining the
current state so the "right" "better" error message can be displayed will be
complex and - in some cases - may not be possible.

Therefore, I do not intend to fix this issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #2 from Claude Brisson <cl...@renegat.net> ---
Created attachment 37190
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37190&action=edit
Servlet keeping running services

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
When I try this on both Tomcat 10.0.x and 9.0.x I get a variation of the
following:

21-Apr-2020 17:20:36.818 WARNING [Thread-4]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web
application [tomcat-bugs] appears to have started a thread named [Thread-5] but
has failed to stop it. This is very likely to create a memory leak. Stack trace
of thread:
 java.lang.Object.wait(Native Method)
 org.apache.tomcat.Bug64366$NotStoppedService.run(Bug64366.java:50)
 java.lang.Thread.run(Thread.java:748)


That looks to be a reasonable error message for the circumstances. I am unable
to reproduce the NPE in the description above.

Are there other configuration changes to make to a clean Tomcat install to
trigger this error. I note you are using systemctl. Are you using a package
provided by your distribution? If so, so you see the same error with a Tomcat
installation obtained directly from the ASF?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #6 from Claude Brisson <cl...@renegat.net> ---
If you let the waiting time tend towards zero, you should observe the NPE. If
tomcat closes while the servlet is waiting, there is no special problem, of
course.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

--- Comment #3 from Claude Brisson <cl...@renegat.net> ---
The web application *should* close long-living connections, and tomcat *should*
report the problem, I agree.

The point is whether tomcat can do better than report an NPE.

I attached a simple servlet.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 64366] [sse] NPE while closing async http/2 connector

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64366

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Tomcat should be signalling that the web application is stopping enabling the
application to stop cleanly.

What I can't tell is whether Tomcat isn't sending that notification, is sending
it to late or if the application isn't handling it correctly.

Can you please provide the simplest possible web application that reproduces
this issue on the latest 9.0.x release (or latest 7.0.x, 8.5.x or 10.0.x if
that is easier) so we can reproduce this issue. Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org