activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul French <paul.fre...@frenchiesystems.com>
Subject Async Exception, multiple threads, one connection
Date Thu, 08 Feb 2007 16:02:29 GMT

For me this is a continuation of.....

http://www.nabble.com/Async-Exception%3A-Broken-Pipe-t3160498s2354.html#a8765808

...but I have now taking the advice from the above post and have refined the
problem I am having.


Environment
I am now using the latest 4.2 snapshot as requested (29th Jan 2007)
I am also running the broker on its own dedicated machine.
I am also using Java HotSpot(TM) Server VM (build 1.5.0_06-b05, mixed mode)
on all machines.

Configuration
ActiveMQ broker is configured with no persistence and no transactions are
used. Async messaging is used.

Problem
I have a program that simply starts as many threads (non-daemon) as you
require (I use 20). Once all threads have been started the main thread
simply finishes. Each thread does the following:

Gets a connection

    connection = singleConnectionFactory.createConnection();

where the following spring context snippet is used

  <bean id="connectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory"
destroy-method="destroy">
    <property name="targetConnectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL"
value="tcp://192.168.160.86:61616?jms.prefetchPolicy.queuePrefetch=1" />
        <property name="useAsyncSend"><value>TRUE</value></property>
      </bean>
    </property>
  </bean>

Please note that each thread is given the same connection since I am using a
SingleConnectionFactory. Each thread then runs in a continuous loop doing
nothing of interest. I do not create any sessions, producers or consumers
and I do not send any messages. I do not touch the connection whatsoever!!!

then after five minutes or so my program reports the Exception..........

WARN  [08/02/2007 11:47:01]: Async exception with no exception listener:
java.net.SocketException: Broken pipe
java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at
org.apache.activemq.transport.tcp.TcpBufferedOutputStream.flush(TcpBufferedOutputStream.java:109)
        at java.io.DataOutputStream.flush(DataOutputStream.java:106)
        at
org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:119)
        at
org.apache.activemq.transport.InactivityMonitor.writeCheck(InactivityMonitor.java:81)
        at
org.apache.activemq.transport.InactivityMonitor.access$100(InactivityMonitor.java:35)
        at
org.apache.activemq.transport.InactivityMonitor$2.run(InactivityMonitor.java:57)
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

The wierd thing is I know my program is about to report this Exception since
all threads in my program stop doing any activity for about 25 seconds.
During this 25 seconds the above Exception is thrown. Then all my threads
carry on as normal.

I do not understand why having a single connection open should cause such
problems and stop all my threads. Any ideas? I know this problem does not
seem to relate to a real life situation but I have factored it out as a
problem from a real situation and tried to simplify the example.





-- 
View this message in context: http://www.nabble.com/Async-Exception%2C-multiple-threads%2C-one-connection-tf3194160s2354.html#a8868199
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message