You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ric Bernat <ri...@brinydeep.net> on 2015/06/29 08:12:25 UTC

why is Tomcat 7 invoking WebSocket protocol?

We have a Jersey application running on Tomcat 7.0.62. In production, 
99.9% of our web service calls run quickly (e.g., 100ms), but there are 
about half a dozen web service calls per hour that take an extraordinary 
amount of time to complete: 30-120 seconds (not ms).

We do not use WebSockets in our application. However, our profiling tool 
clearly shows that Tomcat is invoking the WebSocket protocol on the 
slow-running web service calls. In the stack trace below, see this line:

org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)

How can we track down what is causing Tomcat to use the WebSocket 
protocol, given that our application code does not make any references 
to WebSocket annotations, etc.? Or is there a configuration option we 
can use to cause Tomcat to not use WebSockets?

Thanks much.

  Stack trace
   org.glassfish.jersey.server.ApplicationHandler.handle 
(ApplicationHandler.java:13)
       org.glassfish.jersey.servlet.WebComponent.service 
(WebComponent.java:401)
   org.glassfish.jersey.servlet.ServletContainer.service 
(ServletContainer.java:386)
   org.glassfish.jersey.servlet.ServletContainer.service 
(ServletContainer.java:335)
   org.glassfish.jersey.servlet.ServletContainer.service 
(ServletContainer.java:222)
….catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:303)
…g.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:208)
    org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)
….catalina.core.ApplicationFilterChain.internalDoFilter 
(ApplicationFilterChain.java:241)
…g.apache.catalina.core.ApplicationFilterChain.doFilter 
(ApplicationFilterChain.java:208)
    org.apache.catalina.core.StandardWrapperValve.invoke 
(StandardWrapperValve.java:220)
    org.apache.catalina.core.StandardContextValve.invoke 
(StandardContextValve.java:122)
…apache.catalina.authenticator.AuthenticatorBase.invoke 
(AuthenticatorBase.java:505)
       org.apache.catalina.core.StandardHostValve.invoke 
(StandardHostValve.java:170)
      org.apache.catalina.valves.ErrorReportValve.invoke 
(ErrorReportValve.java:103)
        org.apache.catalina.valves.AccessLogValve.invoke 
(AccessLogValve.java:957)
     org.apache.catalina.core.StandardEngineValve.invoke 
(StandardEngineValve.java:116)
     org.apache.catalina.connector.CoyoteAdapter.service 
(CoyoteAdapter.java:423)
…g.apache.coyote.http11.AbstractHttp11Processor.process 
(AbstractHttp11Processor.java:1079)
…ote.AbstractProtocol$AbstractConnectionHandler.process 
(AbstractProtocol.java:620)
…ache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun 
(NioEndpoint.java:1747)
…apache.tomcat.util.net.NioEndpoint$SocketProcessor.run 
(NioEndpoint.java:1706)
       java.util.concurrent.ThreadPoolExecutor.runWorker 
(ThreadPoolExecutor.java:1145)
      java.util.concurrent.ThreadPoolExecutor$Worker.run 
(ThreadPoolExecutor.java:615)
…he.tomcat.util.threads.TaskThread$WrappingRunnable.run (TaskThread.java:61)
                                    java.lang.Thread.run (Thread.java:745)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Kiran Badi <ki...@poonam.org>.
Thanks Charles for clarification.

On Tue, Jun 30, 2015 at 12:47 PM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Kiran Badi [mailto:kiran@poonam.org]
> > Subject: Re: why is Tomcat 7 invoking WebSocket protocol?
>
> > I know for sure I am not using websockets in my application, but stack
> > trace shows me wsfilter used by tomcat getting called for some reason,
>
> As it should be.
>
> > Just for understanding purpose, is this valid flow , exceptions needs to
> > bubble up through all the filters ?
>
> Of course.  Any method on the call stack gets a shot at the exception.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail and
> its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: why is Tomcat 7 invoking WebSocket protocol?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Kiran Badi [mailto:kiran@poonam.org] 
> Subject: Re: why is Tomcat 7 invoking WebSocket protocol?

> I know for sure I am not using websockets in my application, but stack
> trace shows me wsfilter used by tomcat getting called for some reason,

As it should be.

> Just for understanding purpose, is this valid flow , exceptions needs to
> bubble up through all the filters ?

Of course.  Any method on the call stack gets a shot at the exception.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Kiran Badi <ki...@poonam.org>.
I know for sure I am not using websockets in my application, but stack
trace shows me wsfilter used by tomcat getting called for some reason,

Below is one of the stack trace  I had in my application, exception was
valid but if you look at complete stack trace below we can see exception
propagates through all filters namely S2, Log4j Servlet, my custom filter
and finally through WS Filter.

Just for understanding purpose, is this valid flow , exceptions needs to
bubble up through all the filters ?



com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mytable'
doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2828)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2777)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1651)
at MyApp.MyAppPackage.MyClassDAO.viewAllRecords(MyClassDAO.java:44)
at MyApp.MyAppPackage.MyClass.processRequest(MyClass.java:51)
at MyApp.MyAppPackage.MyClass.doGet(MyClass.java:78)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:64)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at MyApp.handlers.MyServlet.processRequest(MyServlet.java:75)
at MyApp.handlers.MyServlet.doGet(MyServlet.java:239)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.MyFilter.MyApp.global.Handlers.trimresponse.doFilter(trimresponse.java:45)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

On Tue, Jun 30, 2015 at 12:23 PM, André Warnier <aw...@ice-sa.com> wrote:

> Hi.
>
> Sorry to jump in, and to top-post, and maybe make an irreverential comment
> :
>
> But maybe the solution consists simply in renaming that filter, so that it
> does not give the mistaken impression that the WebSocket protocol is
> necessarily being used ?
>
> Kiran Badi wrote:
>
>> Hi Mark,
>>
>> Sorry to jumping in
>>
>> But even I have seen this in few of my exception traces though I never use
>> websockets.Some where down the line when exception is thrown wsfilter
>> shows
>> up in traces.I am guessing it should be some kind of exception filter so
>> it
>> bubbles up for exception types irrespective of protocol.
>>
>> Let me check my old stack traces and post few snippets of it,but they were
>> valid exception in my case just that I never had websockets in my app.
>>
>> On Monday, June 29, 2015, Mark Thomas <ma...@apache.org> wrote:
>>
>>  On 29/06/2015 07:12, Ric Bernat wrote:
>>>
>>>> We have a Jersey application running on Tomcat 7.0.62. In production,
>>>> 99.9% of our web service calls run quickly (e.g., 100ms), but there are
>>>> about half a dozen web service calls per hour that take an extraordinary
>>>> amount of time to complete: 30-120 seconds (not ms).
>>>>
>>>> We do not use WebSockets in our application. However, our profiling tool
>>>> clearly shows that Tomcat is invoking the WebSocket protocol on the
>>>> slow-running web service calls. In the stack trace below, see this line:
>>>>
>>>> org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)
>>>>
>>> That shows nothing of the sort. I suggest you take a look at the code in
>>> question before jumping to invalid conclusions.
>>>
>>> Mark
>>>
>>>
>>>  How can we track down what is causing Tomcat to use the WebSocket
>>>> protocol, given that our application code does not make any references
>>>> to WebSocket annotations, etc.? Or is there a configuration option we
>>>> can use to cause Tomcat to not use WebSockets?
>>>>
>>>> Thanks much.
>>>>
>>>>  Stack trace
>>>>   org.glassfish.jersey.server.ApplicationHandler.handle
>>>> (ApplicationHandler.java:13)
>>>>       org.glassfish.jersey.servlet.WebComponent.service
>>>> (WebComponent.java:401)
>>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>>> (ServletContainer.java:386)
>>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>>> (ServletContainer.java:335)
>>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>>> (ServletContainer.java:222)
>>>> ….catalina.core.ApplicationFilterChain.internalDoFilter
>>>> (ApplicationFilterChain.java:303)
>>>> …g.apache.catalina.core.ApplicationFilterChain.doFilter
>>>> (ApplicationFilterChain.java:208)
>>>>    org.apache.tomcat.websocket.server.WsFilter.doFilter
>>>>
>>> (WsFilter.java:46)
>>>
>>>> ….catalina.core.ApplicationFilterChain.internalDoFilter
>>>> (ApplicationFilterChain.java:241)
>>>> …g.apache.catalina.core.ApplicationFilterChain.doFilter
>>>> (ApplicationFilterChain.java:208)
>>>>    org.apache.catalina.core.StandardWrapperValve.invoke
>>>> (StandardWrapperValve.java:220)
>>>>    org.apache.catalina.core.StandardContextValve.invoke
>>>> (StandardContextValve.java:122)
>>>> …apache.catalina.authenticator.AuthenticatorBase.invoke
>>>> (AuthenticatorBase.java:505)
>>>>       org.apache.catalina.core.StandardHostValve.invoke
>>>> (StandardHostValve.java:170)
>>>>      org.apache.catalina.valves.ErrorReportValve.invoke
>>>> (ErrorReportValve.java:103)
>>>>        org.apache.catalina.valves.AccessLogValve.invoke
>>>> (AccessLogValve.java:957)
>>>>     org.apache.catalina.core.StandardEngineValve.invoke
>>>> (StandardEngineValve.java:116)
>>>>     org.apache.catalina.connector.CoyoteAdapter.service
>>>> (CoyoteAdapter.java:423)
>>>> …g.apache.coyote.http11.AbstractHttp11Processor.process
>>>> (AbstractHttp11Processor.java:1079)
>>>> …ote.AbstractProtocol$AbstractConnectionHandler.process
>>>> (AbstractProtocol.java:620)
>>>> …ache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
>>>> (NioEndpoint.java:1747)
>>>> …apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
>>>> (NioEndpoint.java:1706)
>>>>       java.util.concurrent.ThreadPoolExecutor.runWorker
>>>> (ThreadPoolExecutor.java:1145)
>>>>      java.util.concurrent.ThreadPoolExecutor$Worker.run
>>>> (ThreadPoolExecutor.java:615)
>>>> …he.tomcat.util.threads.TaskThread$WrappingRunnable.run
>>>> (TaskThread.java:61)
>>>>                                    java.lang.Thread.run
>>>> (Thread.java:745)
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>
>>> <javascript:;>
>>>
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>> <javascript:;>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> <javascript:;>
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> <javascript:;>
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Ric Bernat <ri...@brinydeep.net>.

On 7/1/2015 5:44 AM, Konstantin Kolinko wrote:
> 2015-07-01 13:42 GMT+03:00 André Warnier <aw...@ice-sa.com>:
>> Caldarale, Charles R wrote:
>>>> From: André Warnier [mailto:aw@ice-sa.com] Subject: Re: why is Tomcat 7
>>>> invoking WebSocket protocol?
>>>
>>>> But maybe the solution consists simply in renaming that filter, so that
>>>> it does not give the mistaken impression that the WebSocket protocol is
>>>> necessarily being used ?
>>>
>>> That can't be a "solution", because there really isn't a problem here.
>>> The WsFilter has to be in the chain, just in case there's a websocket
>>> upgrade in the request.  The OP needs to focus on the real problem, not this
>>> non-issue.
>>>
>> Hi.
>> I did not mean "solution" as correcting a "problem".  I understand that the
>> filter has to be there.
>> I meant "solution" in the sense of probably avoiding a lot of questions in
>> the future about the same thing.  Maybe renaming it to something like
>> "ProtocolDetectionFilter" would be less of a trigger for the uninformed
>> public.
>
> Explanation why WsFilter is needed is here:
> https://bz.apache.org/bugzilla/show_bug.cgi?id=55855
>
> Maybe it is worth mentioning the filter in
> http://tomcat.apache.org/tomcat-8.0-doc/config/filter.html  I do not
> think that it is worth renaming it.
>
> I added mention of configuration option to
> https://wiki.apache.org/tomcat/HowTo/FasterStartUp
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Hi. I am the OP. Thanks, all, for this discussion. I see that I was 
barking up the wrong tree with my WebSocket theory. I have confirmed 
that our problem exists outside of the (apparent) WebSocket processing. 
Sorry to jump to an incorrect conclusion. We will track down our 
problem, and I will reply back here if there is anything useful and/or 
Tomcat-related to report.

Ric


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-07-01 13:42 GMT+03:00 André Warnier <aw...@ice-sa.com>:
> Caldarale, Charles R wrote:
>>>
>>> From: André Warnier [mailto:aw@ice-sa.com] Subject: Re: why is Tomcat 7
>>> invoking WebSocket protocol?
>>
>>
>>> But maybe the solution consists simply in renaming that filter, so that
>>> it does not give the mistaken impression that the WebSocket protocol is
>>> necessarily being used ?
>>
>>
>> That can't be a "solution", because there really isn't a problem here.
>> The WsFilter has to be in the chain, just in case there's a websocket
>> upgrade in the request.  The OP needs to focus on the real problem, not this
>> non-issue.
>>
> Hi.
> I did not mean "solution" as correcting a "problem".  I understand that the
> filter has to be there.
> I meant "solution" in the sense of probably avoiding a lot of questions in
> the future about the same thing.  Maybe renaming it to something like
> "ProtocolDetectionFilter" would be less of a trigger for the uninformed
> public.


Explanation why WsFilter is needed is here:
https://bz.apache.org/bugzilla/show_bug.cgi?id=55855

Maybe it is worth mentioning the filter in
http://tomcat.apache.org/tomcat-8.0-doc/config/filter.html  I do not
think that it is worth renaming it.

I added mention of configuration option to
https://wiki.apache.org/tomcat/HowTo/FasterStartUp

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>> From: André Warnier [mailto:aw@ice-sa.com] 
>> Subject: Re: why is Tomcat 7 invoking WebSocket protocol?
> 
>> But maybe the solution consists simply in renaming that filter, so that it does not 
>> give the mistaken impression that the WebSocket protocol is necessarily being used ?
> 
> That can't be a "solution", because there really isn't a problem here.  The WsFilter has to be in the chain, just in case there's a websocket upgrade in the request.  The OP needs to focus on the real problem, not this non-issue.
> 
Hi.
I did not mean "solution" as correcting a "problem".  I understand that the filter has to 
be there.
I meant "solution" in the sense of probably avoiding a lot of questions in the future 
about the same thing.  Maybe renaming it to something like "ProtocolDetectionFilter" would 
be less of a trigger for the uninformed public.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: why is Tomcat 7 invoking WebSocket protocol?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: why is Tomcat 7 invoking WebSocket protocol?

> But maybe the solution consists simply in renaming that filter, so that it does not 
> give the mistaken impression that the WebSocket protocol is necessarily being used ?

That can't be a "solution", because there really isn't a problem here.  The WsFilter has to be in the chain, just in case there's a websocket upgrade in the request.  The OP needs to focus on the real problem, not this non-issue.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by André Warnier <aw...@ice-sa.com>.
Hi.

Sorry to jump in, and to top-post, and maybe make an irreverential comment :

But maybe the solution consists simply in renaming that filter, so that it does not give 
the mistaken impression that the WebSocket protocol is necessarily being used ?

Kiran Badi wrote:
> Hi Mark,
> 
> Sorry to jumping in
> 
> But even I have seen this in few of my exception traces though I never use
> websockets.Some where down the line when exception is thrown wsfilter shows
> up in traces.I am guessing it should be some kind of exception filter so it
> bubbles up for exception types irrespective of protocol.
> 
> Let me check my old stack traces and post few snippets of it,but they were
> valid exception in my case just that I never had websockets in my app.
> 
> On Monday, June 29, 2015, Mark Thomas <ma...@apache.org> wrote:
> 
>> On 29/06/2015 07:12, Ric Bernat wrote:
>>> We have a Jersey application running on Tomcat 7.0.62. In production,
>>> 99.9% of our web service calls run quickly (e.g., 100ms), but there are
>>> about half a dozen web service calls per hour that take an extraordinary
>>> amount of time to complete: 30-120 seconds (not ms).
>>>
>>> We do not use WebSockets in our application. However, our profiling tool
>>> clearly shows that Tomcat is invoking the WebSocket protocol on the
>>> slow-running web service calls. In the stack trace below, see this line:
>>>
>>> org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)
>> That shows nothing of the sort. I suggest you take a look at the code in
>> question before jumping to invalid conclusions.
>>
>> Mark
>>
>>
>>> How can we track down what is causing Tomcat to use the WebSocket
>>> protocol, given that our application code does not make any references
>>> to WebSocket annotations, etc.? Or is there a configuration option we
>>> can use to cause Tomcat to not use WebSockets?
>>>
>>> Thanks much.
>>>
>>>  Stack trace
>>>   org.glassfish.jersey.server.ApplicationHandler.handle
>>> (ApplicationHandler.java:13)
>>>       org.glassfish.jersey.servlet.WebComponent.service
>>> (WebComponent.java:401)
>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>> (ServletContainer.java:386)
>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>> (ServletContainer.java:335)
>>>   org.glassfish.jersey.servlet.ServletContainer.service
>>> (ServletContainer.java:222)
>>> ….catalina.core.ApplicationFilterChain.internalDoFilter
>>> (ApplicationFilterChain.java:303)
>>> …g.apache.catalina.core.ApplicationFilterChain.doFilter
>>> (ApplicationFilterChain.java:208)
>>>    org.apache.tomcat.websocket.server.WsFilter.doFilter
>> (WsFilter.java:46)
>>> ….catalina.core.ApplicationFilterChain.internalDoFilter
>>> (ApplicationFilterChain.java:241)
>>> …g.apache.catalina.core.ApplicationFilterChain.doFilter
>>> (ApplicationFilterChain.java:208)
>>>    org.apache.catalina.core.StandardWrapperValve.invoke
>>> (StandardWrapperValve.java:220)
>>>    org.apache.catalina.core.StandardContextValve.invoke
>>> (StandardContextValve.java:122)
>>> …apache.catalina.authenticator.AuthenticatorBase.invoke
>>> (AuthenticatorBase.java:505)
>>>       org.apache.catalina.core.StandardHostValve.invoke
>>> (StandardHostValve.java:170)
>>>      org.apache.catalina.valves.ErrorReportValve.invoke
>>> (ErrorReportValve.java:103)
>>>        org.apache.catalina.valves.AccessLogValve.invoke
>>> (AccessLogValve.java:957)
>>>     org.apache.catalina.core.StandardEngineValve.invoke
>>> (StandardEngineValve.java:116)
>>>     org.apache.catalina.connector.CoyoteAdapter.service
>>> (CoyoteAdapter.java:423)
>>> …g.apache.coyote.http11.AbstractHttp11Processor.process
>>> (AbstractHttp11Processor.java:1079)
>>> …ote.AbstractProtocol$AbstractConnectionHandler.process
>>> (AbstractProtocol.java:620)
>>> …ache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
>>> (NioEndpoint.java:1747)
>>> …apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
>>> (NioEndpoint.java:1706)
>>>       java.util.concurrent.ThreadPoolExecutor.runWorker
>>> (ThreadPoolExecutor.java:1145)
>>>      java.util.concurrent.ThreadPoolExecutor$Worker.run
>>> (ThreadPoolExecutor.java:615)
>>> …he.tomcat.util.threads.TaskThread$WrappingRunnable.run
>>> (TaskThread.java:61)
>>>                                    java.lang.Thread.run (Thread.java:745)
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> <javascript:;>
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>> <javascript:;>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org <javascript:;>
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> <javascript:;>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Kiran Badi <ki...@poonam.org>.
Hi Mark,

Sorry to jumping in

But even I have seen this in few of my exception traces though I never use
websockets.Some where down the line when exception is thrown wsfilter shows
up in traces.I am guessing it should be some kind of exception filter so it
bubbles up for exception types irrespective of protocol.

Let me check my old stack traces and post few snippets of it,but they were
valid exception in my case just that I never had websockets in my app.

On Monday, June 29, 2015, Mark Thomas <ma...@apache.org> wrote:

> On 29/06/2015 07:12, Ric Bernat wrote:
> >
> > We have a Jersey application running on Tomcat 7.0.62. In production,
> > 99.9% of our web service calls run quickly (e.g., 100ms), but there are
> > about half a dozen web service calls per hour that take an extraordinary
> > amount of time to complete: 30-120 seconds (not ms).
> >
> > We do not use WebSockets in our application. However, our profiling tool
> > clearly shows that Tomcat is invoking the WebSocket protocol on the
> > slow-running web service calls. In the stack trace below, see this line:
> >
> > org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)
>
> That shows nothing of the sort. I suggest you take a look at the code in
> question before jumping to invalid conclusions.
>
> Mark
>
>
> >
> > How can we track down what is causing Tomcat to use the WebSocket
> > protocol, given that our application code does not make any references
> > to WebSocket annotations, etc.? Or is there a configuration option we
> > can use to cause Tomcat to not use WebSockets?
> >
> > Thanks much.
> >
> >  Stack trace
> >   org.glassfish.jersey.server.ApplicationHandler.handle
> > (ApplicationHandler.java:13)
> >       org.glassfish.jersey.servlet.WebComponent.service
> > (WebComponent.java:401)
> >   org.glassfish.jersey.servlet.ServletContainer.service
> > (ServletContainer.java:386)
> >   org.glassfish.jersey.servlet.ServletContainer.service
> > (ServletContainer.java:335)
> >   org.glassfish.jersey.servlet.ServletContainer.service
> > (ServletContainer.java:222)
> > ….catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:303)
> > …g.apache.catalina.core.ApplicationFilterChain.doFilter
> > (ApplicationFilterChain.java:208)
> >    org.apache.tomcat.websocket.server.WsFilter.doFilter
> (WsFilter.java:46)
> > ….catalina.core.ApplicationFilterChain.internalDoFilter
> > (ApplicationFilterChain.java:241)
> > …g.apache.catalina.core.ApplicationFilterChain.doFilter
> > (ApplicationFilterChain.java:208)
> >    org.apache.catalina.core.StandardWrapperValve.invoke
> > (StandardWrapperValve.java:220)
> >    org.apache.catalina.core.StandardContextValve.invoke
> > (StandardContextValve.java:122)
> > …apache.catalina.authenticator.AuthenticatorBase.invoke
> > (AuthenticatorBase.java:505)
> >       org.apache.catalina.core.StandardHostValve.invoke
> > (StandardHostValve.java:170)
> >      org.apache.catalina.valves.ErrorReportValve.invoke
> > (ErrorReportValve.java:103)
> >        org.apache.catalina.valves.AccessLogValve.invoke
> > (AccessLogValve.java:957)
> >     org.apache.catalina.core.StandardEngineValve.invoke
> > (StandardEngineValve.java:116)
> >     org.apache.catalina.connector.CoyoteAdapter.service
> > (CoyoteAdapter.java:423)
> > …g.apache.coyote.http11.AbstractHttp11Processor.process
> > (AbstractHttp11Processor.java:1079)
> > …ote.AbstractProtocol$AbstractConnectionHandler.process
> > (AbstractProtocol.java:620)
> > …ache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
> > (NioEndpoint.java:1747)
> > …apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
> > (NioEndpoint.java:1706)
> >       java.util.concurrent.ThreadPoolExecutor.runWorker
> > (ThreadPoolExecutor.java:1145)
> >      java.util.concurrent.ThreadPoolExecutor$Worker.run
> > (ThreadPoolExecutor.java:615)
> > …he.tomcat.util.threads.TaskThread$WrappingRunnable.run
> > (TaskThread.java:61)
> >                                    java.lang.Thread.run (Thread.java:745)
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <javascript:;>
> > For additional commands, e-mail: users-help@tomcat.apache.org
> <javascript:;>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org <javascript:;>
> For additional commands, e-mail: users-help@tomcat.apache.org
> <javascript:;>
>
>

Re: why is Tomcat 7 invoking WebSocket protocol?

Posted by Mark Thomas <ma...@apache.org>.
On 29/06/2015 07:12, Ric Bernat wrote:
> 
> We have a Jersey application running on Tomcat 7.0.62. In production,
> 99.9% of our web service calls run quickly (e.g., 100ms), but there are
> about half a dozen web service calls per hour that take an extraordinary
> amount of time to complete: 30-120 seconds (not ms).
> 
> We do not use WebSockets in our application. However, our profiling tool
> clearly shows that Tomcat is invoking the WebSocket protocol on the
> slow-running web service calls. In the stack trace below, see this line:
> 
> org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)

That shows nothing of the sort. I suggest you take a look at the code in
question before jumping to invalid conclusions.

Mark


> 
> How can we track down what is causing Tomcat to use the WebSocket
> protocol, given that our application code does not make any references
> to WebSocket annotations, etc.? Or is there a configuration option we
> can use to cause Tomcat to not use WebSockets?
> 
> Thanks much.
> 
>  Stack trace
>   org.glassfish.jersey.server.ApplicationHandler.handle
> (ApplicationHandler.java:13)
>       org.glassfish.jersey.servlet.WebComponent.service
> (WebComponent.java:401)
>   org.glassfish.jersey.servlet.ServletContainer.service
> (ServletContainer.java:386)
>   org.glassfish.jersey.servlet.ServletContainer.service
> (ServletContainer.java:335)
>   org.glassfish.jersey.servlet.ServletContainer.service
> (ServletContainer.java:222)
> ….catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:303)
> …g.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:208)
>    org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:46)
> ….catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:241)
> …g.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:208)
>    org.apache.catalina.core.StandardWrapperValve.invoke
> (StandardWrapperValve.java:220)
>    org.apache.catalina.core.StandardContextValve.invoke
> (StandardContextValve.java:122)
> …apache.catalina.authenticator.AuthenticatorBase.invoke
> (AuthenticatorBase.java:505)
>       org.apache.catalina.core.StandardHostValve.invoke
> (StandardHostValve.java:170)
>      org.apache.catalina.valves.ErrorReportValve.invoke
> (ErrorReportValve.java:103)
>        org.apache.catalina.valves.AccessLogValve.invoke
> (AccessLogValve.java:957)
>     org.apache.catalina.core.StandardEngineValve.invoke
> (StandardEngineValve.java:116)
>     org.apache.catalina.connector.CoyoteAdapter.service
> (CoyoteAdapter.java:423)
> …g.apache.coyote.http11.AbstractHttp11Processor.process
> (AbstractHttp11Processor.java:1079)
> …ote.AbstractProtocol$AbstractConnectionHandler.process
> (AbstractProtocol.java:620)
> …ache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun
> (NioEndpoint.java:1747)
> …apache.tomcat.util.net.NioEndpoint$SocketProcessor.run
> (NioEndpoint.java:1706)
>       java.util.concurrent.ThreadPoolExecutor.runWorker
> (ThreadPoolExecutor.java:1145)
>      java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:615)
> …he.tomcat.util.threads.TaskThread$WrappingRunnable.run
> (TaskThread.java:61)
>                                    java.lang.Thread.run (Thread.java:745)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org