Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.3-rc2
  • Fix Version/s: 1.3-rc3
  • Component/s: Core: Transports
  • Labels:
    None
  • Environment:

    Mac OS X 10.4.6 on MacBook Pro,
    java version "1.5.0_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
    Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

  • Similar Issues:
    None

Description

SystemStreamConnector hangs when disposing.

This is the last line of log...
INFO: Disposing Connector: org.mule.providers.stream.SystemStreamConnector

this is the stacktrace after kill -3...
Full thread dump Java HotSpot(TM) Client VM (1.5.0_06-64 mixed mode, sharing):

"_streamConnector#8807447.System.in.receiver.1" prio=7 tid=0x00516510 nid=0x192ea00 runnable [0xb0e05000..0xb0e05d10]
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:194)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
at java.io.BufferedInputStream.read(BufferedInputStream.java:313)

  • locked <0x26a85bb0> (a java.io.BufferedInputStream)
    at java.io.FilterInputStream.read(FilterInputStream.java:90)
    at org.mule.providers.stream.StreamMessageReceiver.poll(StreamMessageReceiver.java:88)
    at org.mule.providers.PollingMessageReceiver.run(PollingMessageReceiver.java:75)
    at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:613)

"UMOManager.1" prio=5 tid=0x00513e80 nid=0x1934c00 in Object.wait() [0xb0c82000..0xb0c82d10]
at java.lang.Object.wait(Native Method)

  • waiting on <0x283a1a40> (a edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
    at java.lang.Object.wait(Object.java:474)
    at edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:315)
  • locked <0x283a1a40> (a edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$SerializableLock)
    at org.mule.impl.internal.notifications.ServerNotificationManager.run(ServerNotificationManager.java:192)
    at org.mule.impl.work.WorkerContext.run(WorkerContext.java:290)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:613)

"Low Memory Detector" daemon prio=5 tid=0x00508dc0 nid=0x1817a00 runnable [0x00000000..0x00000000]

"CompilerThread0" daemon prio=9 tid=0x005083c0 nid=0x1817600 waiting on condition [0x00000000..0xb0aff74c]

"Signal Dispatcher" daemon prio=9 tid=0x00507eb0 nid=0x1817200 waiting on condition [0x00000000..0x00000000]

"Finalizer" daemon prio=8 tid=0x00507620 nid=0x1812000 in Object.wait() [0xb09fd000..0xb09fdd10]
at java.lang.Object.wait(Native Method)

  • waiting on <0x26a83ec8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
  • locked <0x26a83ec8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00507220 nid=0x1811000 in Object.wait() [0xb097c000..0xb097cd10]
at java.lang.Object.wait(Native Method)

  • waiting on <0x26a83f48> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:474)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
  • locked <0x26a83f48> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x005012d0 nid=0x1805800 runnable [0xb07f8000..0xb07f90dc]
at java.io.FileInputStream.close0(Native Method)
at java.io.FileInputStream.close(FileInputStream.java:245)
at java.io.BufferedInputStream.close(BufferedInputStream.java:440)
at org.apache.commons.io.IOUtils.closeQuietly(IOUtils.java:175)
at org.mule.providers.stream.StreamConnector.doDispose(StreamConnector.java:68)
at org.mule.providers.AbstractConnector.dispose(AbstractConnector.java:406)

  • locked <0x267f4b20> (a org.mule.providers.stream.SystemStreamConnector)
    at org.mule.MuleManager.disposeConnectors(MuleManager.java:434)
  • locked <0x283a1a80> (a org.mule.MuleManager)
    at org.mule.MuleManager.dispose(MuleManager.java:382)
  • locked <0x283a1a80> (a org.mule.MuleManager)
    at MuleTest.main(MuleTest.java:49)

"VM Thread" prio=9 tid=0x00506a10 nid=0x1803c00 runnable

"VM Periodic Task Thread" prio=9 tid=0x00509920 nid=0x1817e00 waiting on condition

"Exception Catcher Thread" prio=10 tid=0x005014f0 nid=0x1806e00 runnable

I'm attaching a self contained test program.

Activity

Hide
Andrew Perepelytsya added a comment -

I observed some problems with SsytemStreamConnector before under m2 build, now I think it's the same pattern. Actually, if you hit the return, you will unblock the poll() method of StreamMessageReceiver, and after dumping an exception about a component having already been stopped finishes normally.

So the task is either to detect any available (or lack of thereof) input, or change the poll method to non-blocking/repeating one.

Show
Andrew Perepelytsya added a comment - I observed some problems with SsytemStreamConnector before under m2 build, now I think it's the same pattern. Actually, if you hit the return, you will unblock the poll() method of StreamMessageReceiver, and after dumping an exception about a component having already been stopped finishes normally. So the task is either to detect any available (or lack of thereof) input, or change the poll method to non-blocking/repeating one.
Hide
Ming Fang added a comment -

Actually the solution is very simple.
Just override doDispose() to do nothing.
This is in fact the right thing to do; it is wrong to actually close the System in/out streams.

Show
Ming Fang added a comment - Actually the solution is very simple. Just override doDispose() to do nothing. This is in fact the right thing to do; it is wrong to actually close the System in/out streams.
Hide
Andrew Perepelytsya added a comment -

Fix committed at http://svn.mule.codehaus.org/changelog/mule/?cs=2033
Thanks for the thread dump, this was insightful. The problems relates to any input streams, though for non-system streams there are usually better solutions (socket timeouts, http keep-alives, etc.). The commit mentions one possible solution for those in comments.

Show
Andrew Perepelytsya added a comment - Fix committed at http://svn.mule.codehaus.org/changelog/mule/?cs=2033 Thanks for the thread dump, this was insightful. The problems relates to any input streams, though for non-system streams there are usually better solutions (socket timeouts, http keep-alives, etc.). The commit mentions one possible solution for those in comments.
Hide
Andrew Perepelytsya added a comment -

Just saw your comment above (my browser session was still active and I didn't refresh the page). We came to the same solution, which is an additional validation

Show
Andrew Perepelytsya added a comment - Just saw your comment above (my browser session was still active and I didn't refresh the page). We came to the same solution, which is an additional validation

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: