5 Replies Latest reply: Aug 9, 2012 5:06 PM by Greg Butler RSS

    a4j:push toomanyfiles

    Greg Butler Newbie

      Hello RichFaces experts,

       

      I am prototyping a website using RichFaces and the ajax push feature. It appears to be working ok, but I beleive I have a configuration issue with my combination of components. Each time a message is published two FIFO pipes are created. Eventually the number of pipes reaches the users open file limit. I think this should only use one set of pipes/resources for the connection, so I am suspecting the 'durablility' of my Topic. I was thinking of swapping application servers and/or message queue products, but I am running short on time. The combination of components are:

       

      GlassFish 3.1.2

      Open Message Queue 4.5.2

      java version "1.7.0"

      richfaces-4.1.0.Final

      CentOS 5.7 Linux 2.6.18-274.12.1.el5

       

       

      The relevent code fragements:

       

      Set up in the constructor:

       

      topicKey = new TopicKey(PUSH_TOPIC,pushName);

      topicsContext = TopicsContext.lookup();

      pushTopic = topicsContext.getOrCreateTopic(topicKey);

       

      Called from the test page:

       

      pushTopic.publish(topicKey, theMessage);

       

      Test page:

       

      <a4j:push

           address="#{TestPushTwo.pushName}@TestPushTopic"

           onerror="alert(event.rf.data)"

           ondataavailable="jQuery(#{rich:element('theMessage')}).text(event.rf.data)">

           <a4j:ajax event="dataavailable" render="thePanel" execute="@none"/>

      </a4j:push>

       

      # lsof -p 10075 | grep -E 'FIFO|COMMAND'

      COMMAND   PID USER   FD   TYPE             DEVICE     SIZE     NODE NAME

      .

      java    10075 greg  389u  FIFO                0,6            943806 pipe

      java    10075 greg  403w  FIFO                0,6            943806 pipe

       

      imqcmd list dst -b gregsworkstation:7676

      ------------------------------------------------------------------------------------------------

           Name       Type    State      Producers        Consumers                  Msgs              

                                      Total  Wildcard  Total  Wildcard  Count  Remote  UnAck  Avg Size

      ------------------------------------------------------------------------------------------------

      .

      TestPushTopic   Topic  RUNNING  0      0         1      0         0      0       0      0.0

      mq.sys.dmq      Queue  RUNNING  0      -         0      -         0      0       0      0.0

       

       

      Thanks in advance.

        • 1. Re: a4j:push toomanyfiles
          Lukáš Fryč Master

          Greg, could you please try new version of RichFaces (4.2.1.Final), where Push was re-designed significantly?

          • 2. Re: a4j:push toomanyfiles
            Greg Butler Newbie

            Thank you Lukas, I have upgraded to 4.2.1.Final. I also upgraded to atmosphere-runtime-0.8.4.jar. Is this a compatible version? I beleive with Glassfish I also need the atmosphere*.8-SNAPSHOT.jar but after googling for 1/2 hour, have not found them. I'll look some more.

             

            My upgraded versions are now:

            Glassfish 3.1.2 b23

            with upgraded RichFaces and Atmosphere libraries:

             

            atmosphere-compat-jbossweb-0.9.0-SNAPSHOT.jar

            atmosphere-compat-jetty-0.9.0-SNAPSHOT.jar

            atmosphere-compat-tomcat-0.9.0-SNAPSHOT.jar

            atmosphere-compat-tomcat7-0.9.0-SNAPSHOT.jar

            atmosphere-compat-weblogic-0.9.0-SNAPSHOT.jar

            atmosphere-runtime-0.9.0-SNAPSHOT.jar

             

            richfaces-components-api-4.2.1.Final.jar

            richfaces-components-ui-4.2.1.Final.jar

            richfaces-core-api-4.2.1.Final.jar

            richfaces-core-impl-4.2.1.Final.jar

             

            I am now getting an error of No Servlet Defined in the Glassfish log file:

             

            TRACE AsynchronousProcessor:257 - Trying to map /[/a-zA-Z0-9-&=;\\?]+ to /__richfaces_push

            TRACE AsynchronousProcessor:257 - Trying to map /[/a-zA-Z0-9-&=;\\?]+ to /__richfaces_push/

            TRACE AsynchronousProcessor:257 - Trying to map /[/a-zA-Z0-9-&=;\\?]+ to /all

            TRACE AsynchronousProcessor:260 - Mapped /[/a-zA-Z0-9-&=;\\?]+ to AtmosphereHandlerWrapper{ atmosphereHandler=org.atmosphere.handler.ReflectorServletProcessor@2364643f, broadcaster=org.atmosphere.cpr.DefaultBroadcaster@334591552

             

                Name: /*

             

                Scope: APPLICATION

             

                BroasdcasterCache org.atmosphere.cpr.BroadcasterConfig$DefaultBroadcasterCache@518a6dfa

             

                AtmosphereResource: 0

            }

            ERROR ReflectorServletProcessor:171 - onRequest()

            javax.servlet.ServletException: No Servlet Defined

                at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:172)

                at org.richfaces.webapp.PushHandlerFilter.doFilter(PushHandlerFilter.java:76)

                at org.atmosphere.util.AtmosphereFilterChain.doFilter(AtmosphereFilterChain.java:154)

                at org.atmosphere.util.AtmosphereFilterChain.invokeFilterChain(AtmosphereFilterChain.java:131)

                at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.service(ReflectorServletProcessor.java:311)

                at org.atmosphere.handler.ReflectorServletProcessor.onRequest(ReflectorServletProcessor.java:169)

                at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:229)

                at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:165)

                at org.atmosphere.container.GrizzlyCometSupport.service(GrizzlyCometSupport.java:119)

                at org.atmosphere.container.GlassFishWebSocketSupport.service(GlassFishWebSocketSupport.java:120)

                at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1091)

                at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:297)

                at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:283)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)

                at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)

                at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)

                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

                at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

                at com.sun.grizzly.comet.CometEngine.executeServlet(CometEngine.java:444)

                at com.sun.grizzly.comet.CometEngine.handle(CometEngine.java:308)

                at com.sun.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:87)

                at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:171)

                at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:143)

                at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:102)

                at com.sun.grizzly.http.TaskBase.run(TaskBase.java:193)

                at com.sun.grizzly.http.TaskBase.execute(TaskBase.java:175)

                at com.sun.grizzly.arp.DefaultAsyncHandler.handle(DefaultAsyncHandler.java:145)

                at com.sun.grizzly.arp.AsyncProtocolFilter.execute(AsyncProtocolFilter.java:210)

                at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                at java.lang.Thread.run(Thread.java:722)

            • 3. Re: a4j:push toomanyfiles
              Lukáš Fryč Master

              Hi Greg, the version which should work is 0.8.4.

              • 4. Re: a4j:push toomanyfiles
                Greg Butler Newbie

                I replaced the atmosphere 9 libraries with:

                 

                atmosphere-compat-jbossweb-0.8.4.jar

                atmosphere-compat-jetty-0.8.4.jar

                atmosphere-compat-tomcat-0.8.4.jar

                atmosphere-compat-tomcat7-0.8.4.jar

                atmosphere-compat-weblogic-0.8.4.jar

                atmosphere-runtime-0.8.4.jar

                 

                behaviour and symptoms are back to the original post.

                • 5. Re: a4j:push toomanyfiles
                  Greg Butler Newbie

                  Hello,

                   

                  I revisited this problem and identified the area where the FIFO pipes are being created, which eventually leads to 'too many files open' error.

                   

                  1) I deployed Nick Belaevski's ChatBean example to JBoss to provide a functional base line. The example worked well with no FIFO pipe issues.

                  2) I deployed the same example to GlassFish and included the requried HornetQ jars. The example functioned the same as with JBoss but created a pair of FIFO pipes each time a chat message was sent.

                  3) So I ported my application from Glassfish to JBoss, learning lots about @Depends with @Startup as well as setContextClassLoader and getObject.

                   

                  In my case, the best solution was to drill down enough to identify how to avoid the problem.

                   

                  The environment my application runs on is now:

                   

                  JBoss AS 6.1.0.Final

                  HornetQ 2.2.5.Final

                  java version 1.7.0

                  richfaces-4.1.0.Final

                  CentOS 5.7 Linux 2.6.18-274.12.1.el5