glassfish
  1. glassfish
  2. GLASSFISH-21058

Websocket create new live threads and never kill it

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: web_socket
    • Labels:
      None
    • Environment:

      Ubuntu 12.04 LTS 64 bit server
      RAM: 10GB
      CPU: 8 cores

      Description

      I tested 1000 concurrent websocket requests and Glassfish created 1000 new live threads and so on.

      I used VisualVM to check and saw new threads always increase.

      If I test with 30000 concurrent websocket request, server got trouble and notice:
      "Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread."

      I updated Tyrus 1.5 to Glassfish 4 but not success because of EJB revoking.

      When I use Glassfish 4.0.1 b3 with Tyrus 1.5, everything ok, no new live thread apprear but sometimes, I got exception like that:

      2014-05-03T00:49:04.690+0700|SEVERE: java.io.IOException: Broken pipe
      at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
      at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
      at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
      at sun.nio.ch.IOUtil.write(IOUtil.java:51)
      at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.flushByteBuffer(TCPNIOTransport.java:1251)
      at org.glassfish.grizzly.nio.transport.TCPNIOAsyncQueueWriter.write0(TCPNIOAsyncQueueWriter.java:107)
      at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.write(AbstractNIOAsyncQueueWriter.java:273)
      at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.write(AbstractNIOAsyncQueueWriter.java:180)
      at org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter.write(AbstractNIOAsyncQueueWriter.java:70)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransportFilter.handleWrite(TCPNIOTransportFilter.java:128)
      at org.glassfish.grizzly.filterchain.TransportFilter.handleWrite(TransportFilter.java:191)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$8.execute(ExecutorResolver.java:111)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.filterchain.FilterChainContext.write(FilterChainContext.java:853)
      at org.glassfish.grizzly.filterchain.FilterChainContext.write(FilterChainContext.java:822)
      at org.glassfish.grizzly.http.io.OutputBuffer.flushBuffer(OutputBuffer.java:1011)
      at org.glassfish.grizzly.http.io.OutputBuffer.flushBinaryBuffers(OutputBuffer.java:996)
      at org.glassfish.grizzly.http.io.OutputBuffer.flushAllBuffers(OutputBuffer.java:967)
      at org.glassfish.grizzly.http.io.OutputBuffer.flush(OutputBuffer.java:732)
      at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:291)
      at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:275)
      at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:175)
      at org.glassfish.tyrus.servlet.TyrusServletWriter._write(TyrusServletWriter.java:165)
      at org.glassfish.tyrus.servlet.TyrusServletWriter.write(TyrusServletWriter.java:144)
      at org.glassfish.tyrus.core.ProtocolHandler.write(ProtocolHandler.java:278)
      at org.glassfish.tyrus.core.ProtocolHandler.send(ProtocolHandler.java:179)
      at org.glassfish.tyrus.core.ProtocolHandler.send(ProtocolHandler.java:174)
      at org.glassfish.tyrus.core.ProtocolHandler.send(ProtocolHandler.java:206)
      at org.glassfish.tyrus.core.TyrusWebSocket.sendText(TyrusWebSocket.java:283)
      at org.glassfish.tyrus.core.TyrusRemoteEndpoint$Basic.sendText(TyrusRemoteEndpoint.java:94)
      at com.gbsofts.gbpriceboard.service.web.BoardDataService.onMessage(BoardDataService.java:119)
      at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1081)
      at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1153)
      at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:4696)
      at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:630)
      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
      at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
      at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:55)
      at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
      at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:582)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
      at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:883)
      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:822)
      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:369)
      at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:4668)
      at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4656)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
      at com.sun.proxy.$Proxy398.onMessage(Unknown Source)
      at com.gbsofts.gbpriceboard.service.web._EJB31_GeneratedBoardDataServiceIntf__Bean_.onMessage(Unknown Source)
      at sun.reflect.GeneratedMethodAccessor225.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.callMethod(AnnotatedEndpoint.java:438)
      at org.glassfish.tyrus.core.AnnotatedEndpoint.access$100(AnnotatedEndpoint.java:86)
      at org.glassfish.tyrus.core.AnnotatedEndpoint$WholeHandler$1.onMessage(AnnotatedEndpoint.java:533)
      at org.glassfish.tyrus.core.TyrusSession.notifyMessageHandlers(TyrusSession.java:430)
      at org.glassfish.tyrus.core.TyrusEndpointWrapper.onMessage(TyrusEndpointWrapper.java:652)
      at org.glassfish.tyrus.core.TyrusWebSocket.onMessage(TyrusWebSocket.java:194)
      at org.glassfish.tyrus.core.frame.TextFrame.respond(TextFrame.java:134)
      at org.glassfish.tyrus.core.ProtocolHandler.process(ProtocolHandler.java:568)
      at org.glassfish.tyrus.core.TyrusWebSocketEngine$TyrusReadHandler.handle(TyrusWebSocketEngine.java:260)
      at org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler.onDataAvailable(TyrusHttpUpgradeHandler.java:164)
      at org.apache.catalina.connector.InputBuffer$ReadHandlerImpl.processDataAvailable(InputBuffer.java:488)
      at org.apache.catalina.connector.InputBuffer$ReadHandlerImpl.onDataAvailable(InputBuffer.java:453)
      at org.glassfish.grizzly.http.io.InputBuffer.append(InputBuffer.java:855)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:220)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:837)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadI
      2014-05-03T00:49:04.690+0700|SEVERE: OStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      at java.lang.Thread.run(Thread.java:744)

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            dungld
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: