ActiveMQ
  1. ActiveMQ
  2. AMQ-2883

EOFException if stomp+nio after ActiveMQ has sent the first bytes message

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.4.0
    • Fix Version/s: 5.4.1
    • Component/s: Transport
    • Labels:
      None
    • Environment:

      Windows Vista

      Description

      Starting broker with C:\Java\apache-activemq-5.4.0\bin\activemq-admin.bat start xbean:activemq-stomp.xml

      The Stomp client sends a number of binary messages but receives only the first one, the broker log on the console looks like this:

      Java Runtime: Sun Microsystems Inc. 1.6.0_07 C:\Program Files\Java\jdk1.6.0_07\j
      re
      Heap sizes: current=5056k free=4360k max=520256k
      JVM args: -Dcom.sun.management.jmxremote -Xmx512M -Dorg.apache.activemq.UseD
      edicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Dact
      ivemq.classpath=C:\Java\apache-activemq-5.4.0\bin\../conf; -Dactivemq.home=C:\Ja
      va\apache-activemq-5.4.0\bin\.. -Dactivemq.base=C:\Java\apache-activemq-5.4.0\bi
      n\..
      ACTIVEMQ_HOME: C:\Java\apache-activemq-5.4.0\bin\..
      ACTIVEMQ_BASE: C:\Java\apache-activemq-5.4.0\bin\..
      Loading message broker from: xbean:activemq-stomp.xml
      INFO | PListStore:C:\Java\apache-activemq-5.4.0\bin\..\data\localhost\tmp_stora
      ge started
      INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\Java\apache-activ
      emq-5.4.0\bin\..\data\kahadb]
      INFO | ActiveMQ 5.4.0 JMS Message Broker (localhost) is starting
      INFO | For help or more information please see: http://activemq.apache.org/
      INFO | Scheduler using directory: activemq-data\scheduler
      INFO | Listening for connections at: stomp://mj-PC:61612?transport.closeAsync=f
      alse
      INFO | Connector stomp Started
      INFO | Listening for connections at: stomp+nio://mj-PC:61613?transport.closeAsy
      nc=false
      INFO | Connector stomp+nio Started
      INFO | ActiveMQ JMS Message Broker (localhost, ID:mj-PC-49520-1283080154792-0:0
      ) started
      INFO | Logging to org.slf4j.impl.JCLLoggerAdapter(org.eclipse.jetty.util.log) v
      ia org.eclipse.jetty.util.log.Slf4jLog
      INFO | jetty-7.0.1.v20091125
      INFO | ActiveMQ WebConsole initialized.
      INFO | Initializing Spring FrameworkServlet 'dispatcher'
      INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
      INFO | Initializing Spring root WebApplicationContext
      INFO | Connector vm://localhost Started
      INFO | Camel Console at http://0.0.0.0:8161/camel
      INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
      INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
      INFO | Started SelectChannelConnector@0.0.0.0:8161
      INFO | Transport failed: java.io.EOFException
      java.io.EOFException
      at org.apache.activemq.transport.stomp.StompNIOTransport.serviceRead(Sto
      mpNIOTransport.java:106)
      at org.apache.activemq.transport.stomp.StompNIOTransport.access$000(Stom
      pNIOTransport.java:51)
      at org.apache.activemq.transport.stomp.StompNIOTransport$1.onSelect(Stom
      pNIOTransport.java:80)
      at org.apache.activemq.transport.nio.SelectorSelection.onSelect(Selector
      Selection.java:94)
      at org.apache.activemq.transport.nio.SelectorWorker$1.run(SelectorWorker
      .java:119)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
      utor.java:885)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:907)
      at java.lang.Thread.run(Thread.java:619)

      The Stomp client log is:

      TCoreIndyTests.TestBytesMessages
      send:
      CONNECT

      received:
      CONNECTED
      session:ID:mj-PC-49520-1283080154792-5:0

      send:
      SUBSCRIBE
      destination:/queue/HabariSpeedTest
      ack:auto
      id:

      {E4BD9658-B92E-4C57-AD9F-F5357BA66FC2}



      send:
      SEND
      destination:/queue/HabariSpeedTest
      content-length:4
      correlation-id:{5B735F2D-349E-4A8A-B2AE-6493A1569F88}

      ☺☻♥1

      send:
      SEND
      destination:/queue/HabariSpeedTest
      content-length:4
      correlation-id:{5B735F2D-349E-4A8A-B2AE-6493A1569F88}

      ☺☻♥2

      send:

      (more messages, ten total)

      received:
      MESSAGE
      message-id:ID:mj-PC-49520-1283080154792-5:0:-1:1:1
      destination:/queue/HabariSpeedTest
      timestamp:1283080192048
      expires:0
      subscription:{E4BD9658-B92E-4C57-AD9F-F5357BA66FC2}

      content-length:4
      priority:0
      correlation-id:

      {5B735F2D-349E-4A8A-B2AE-6493A1569F88}

      ☺☻♥1

      Received 1 messages
      Elapsed: 10000 msec (limit: 10000 msec) - giving up
      send:
      DISCONNECT

      Not sure if this is related but I also see an error in the startup log on later restarts. I reinstalled the broker and the message disappears.

      INFO | jetty-7.0.1.v20091125
      INFO | ActiveMQ WebConsole initialized.
      INFO | Initializing Spring FrameworkServlet 'dispatcher'
      INFO | ActiveMQ Console at http://0.0.0.0:8161/admin
      INFO | Initializing Spring root WebApplicationContext
      ERROR | Could not accept connection : java.nio.channels.ClosedSelectorException <------------------
      INFO | Connector vm://localhost Started
      INFO | Camel Console at http://0.0.0.0:8161/camel
      INFO | ActiveMQ Web Demos at http://0.0.0.0:8161/demo
      INFO | RESTful file access application at http://0.0.0.0:8161/fileserver
      INFO | Started SelectChannelConnector@0.0.0.0:8161

        Activity

        Hide
        Daniel Peters added a comment -

        @Timothy:
        Thanks for the fast fix! Could you maybe backport this fix to a 5.4 branch? I think alot users that rely on Stomp would appriciate it .

        @Nuno:
        good idea too, thanks!

        Show
        Daniel Peters added a comment - @Timothy: Thanks for the fast fix! Could you maybe backport this fix to a 5.4 branch? I think alot users that rely on Stomp would appriciate it . @Nuno: good idea too, thanks!
        Hide
        Nuno Valente added a comment -

        Daniel,
        We had the same problem and because we have lots of Stomp Clients (a couple of hundred), we implemented a workaround with StompConnect.

        Since ActiveMQ 5.4.0 solves a lot of issues (and brings camel 2.4) in 5.3.2 that had impact in our applications we have upgraded our instances use StompConnect instead of somp(+nio) transport connector.
        To implement this solution, you just need the StompConnect jar (available at Codehaus) in your class path, and use the following Spring configuration outside of your broker context:

        <bean id="myFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616"/
        <property name="userName" value="username"/>
        <property name="password" value="password"/>
        </bean>

        <bean id="stompConnector" class="org.codehaus.stomp.jms.StompConnect" init-method="start">
        <property name="connectionFactory" ref="myFactory"/>
        <property name="uri" value="tcp://localhost:61612"/>
        </bean>

        This way you comment your stomp+nio transport connector and leave the forward to your desired ip/port. (this example assumes a user named "user" and password "password". Also assumes that your Stomp messages are heading to localhost:61612 and that the openwire transport connector listens in localhost:61616)

        Hope this helps.
        Best regards,
        Nuno Valente.

        Show
        Nuno Valente added a comment - Daniel, We had the same problem and because we have lots of Stomp Clients (a couple of hundred), we implemented a workaround with StompConnect. Since ActiveMQ 5.4.0 solves a lot of issues (and brings camel 2.4) in 5.3.2 that had impact in our applications we have upgraded our instances use StompConnect instead of somp(+nio) transport connector. To implement this solution, you just need the StompConnect jar (available at Codehaus) in your class path, and use the following Spring configuration outside of your broker context: <bean id="myFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616"/ <property name="userName" value="username"/> <property name="password" value="password"/> </bean> <bean id="stompConnector" class="org.codehaus.stomp.jms.StompConnect" init-method="start"> <property name="connectionFactory" ref="myFactory"/> <property name="uri" value="tcp://localhost:61612"/> </bean> This way you comment your stomp+nio transport connector and leave the forward to your desired ip/port. (this example assumes a user named "user" and password "password". Also assumes that your Stomp messages are heading to localhost:61612 and that the openwire transport connector listens in localhost:61616) Hope this helps. Best regards, Nuno Valente.
        Hide
        Timothy Bish added a comment -

        Fixed in trunk.

        Show
        Timothy Bish added a comment - Fixed in trunk.
        Hide
        Daniel Peters added a comment -

        I just updated our server from 5.3.2 to 5.4.0 and I get the same error with Stomp:
        2010-08-30 12:43:11,681 | INFO | Transport failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ NIO Worker
        java.io.EOFException
        at org.apache.activemq.transport.stomp.StompNIOTransport.serviceRead(StompNIOTransport.java:106)
        at org.apache.activemq.transport.stomp.StompNIOTransport.access$000(StompNIOTransport.java:51)
        at org.apache.activemq.transport.stomp.StompNIOTransport$1.onSelect(StompNIOTransport.java:80)
        at org.apache.activemq.transport.nio.SelectorSelection.onSelect(SelectorSelection.java:94)
        at org.apache.activemq.transport.nio.SelectorWorker$1.run(SelectorWorker.java:119)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

        We had to switch back to 5.3.2 because we have alot stomp clients.

        It doesnt work without NIO either:
        2010-08-30 12:55:15,536 | INFO | Transport failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///192.168.2.89:37025
        java.io.EOFException
        at java.io.DataInputStream.readByte(DataInputStream.java:250)
        at org.apache.activemq.transport.stomp.StompWireFormat.readLine(StompWireFormat.java:146)
        at org.apache.activemq.transport.stomp.StompWireFormat.parseAction(StompWireFormat.java:162)
        at org.apache.activemq.transport.stomp.StompWireFormat.unmarshal(StompWireFormat.java:92)
        at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:226)
        at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:218)
        at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:201)
        at java.lang.Thread.run(Thread.java:619)

        Show
        Daniel Peters added a comment - I just updated our server from 5.3.2 to 5.4.0 and I get the same error with Stomp: 2010-08-30 12:43:11,681 | INFO | Transport failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ NIO Worker java.io.EOFException at org.apache.activemq.transport.stomp.StompNIOTransport.serviceRead(StompNIOTransport.java:106) at org.apache.activemq.transport.stomp.StompNIOTransport.access$000(StompNIOTransport.java:51) at org.apache.activemq.transport.stomp.StompNIOTransport$1.onSelect(StompNIOTransport.java:80) at org.apache.activemq.transport.nio.SelectorSelection.onSelect(SelectorSelection.java:94) at org.apache.activemq.transport.nio.SelectorWorker$1.run(SelectorWorker.java:119) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) We had to switch back to 5.3.2 because we have alot stomp clients. It doesnt work without NIO either: 2010-08-30 12:55:15,536 | INFO | Transport failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///192.168.2.89:37025 java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:250) at org.apache.activemq.transport.stomp.StompWireFormat.readLine(StompWireFormat.java:146) at org.apache.activemq.transport.stomp.StompWireFormat.parseAction(StompWireFormat.java:162) at org.apache.activemq.transport.stomp.StompWireFormat.unmarshal(StompWireFormat.java:92) at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:226) at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:218) at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:201) at java.lang.Thread.run(Thread.java:619)
        Hide
        Timothy Bish added a comment -

        Would be helpful if you could create a unit test that reproduces this error, take a look at the StompTest.java for some sample to work from.

        Show
        Timothy Bish added a comment - Would be helpful if you could create a unit test that reproduces this error, take a look at the StompTest.java for some sample to work from.

          People

          • Assignee:
            Timothy Bish
            Reporter:
            Michael Justin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development