Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Calling Node.shutdown from a MessageListener throws exception (and doesn't shutdown) #270

Open
paol opened this issue Mar 9, 2018 · 1 comment
Labels

Comments

@paol
Copy link

paol commented Mar 9, 2018

(reporting this here as suggested in https://answers.ros.org/question/284838)

What the title says. Looks likely to be a threading problem, since onNewMessage is known to run on a separate thread and the exception happens in a java.util.concurrent primitive.

Using rosjava 0.3.5

Exception in thread "pool-1-thread-13" org.ros.exception.RosRuntimeException: java.lang.InterruptedException
        at org.ros.internal.node.client.Registrar.shutdown(Registrar.java:358)
        at org.ros.internal.node.DefaultNode.shutdown(DefaultNode.java:426)
        at sensei.ros.publishernode.TrackletListener.onNewMessage(TrackletListener.java:76)
        at sensei.ros.publishernode.TrackletListener.onNewMessage(TrackletListener.java:28)
        at org.ros.internal.transport.queue.MessageDispatcher$1.run(MessageDispatcher.java:125)
        at org.ros.internal.transport.queue.MessageDispatcher$1.run(MessageDispatcher.java:122)
        at org.ros.concurrent.EventDispatcher.loop(EventDispatcher.java:43)
        at org.ros.concurrent.CancellableLoop.run(CancellableLoop.java:56)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)
        at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277)
        at org.ros.concurrent.RetryingExecutorService.shutdown(RetryingExecutorService.java:153)
        at org.ros.internal.node.client.Registrar.shutdown(Registrar.java:356)
        ... 10 more
@jubeira jubeira added the bug label Mar 9, 2018
@jubeira
Copy link

jubeira commented Mar 12, 2018

Thanks @paol; if you ever attempt to fix this, please feel free to send a PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants