Enhancement #2670

Informer socket transport is shutting down if publish trigger thread is marked as interruped

Added by M. Pohling almost 5 years ago. Updated almost 5 years ago.

Status:ResolvedStart date:10/21/2016
Priority:NormalDue date:
Assignee:J. Wienke% Done:

100%

Category:Socket Transport
Target version:rsb-0.16

Description

If the publish method is called of an informer participant the overall tcp communication is shutting down (SockedClosed) if the caller thread is marked as interrupted.

It would be nice if just the processing of this call is canceled by an InterrupedException without closing the socked. This would provide further communication via the informer.

WARNING: Unable to send notification on connection rsb.transport.socket.BusClientConnection@329b52e7. Removing this connection.
java.nio.channels.ClosedByInterruptException
    at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202)
    at java.nio.channels.Channels$WritableByteChannelImpl.write(Channels.java:460)
    at rsb.transport.socket.BusConnectionBase.sendNotification(BusConnectionBase.java:304)
    at rsb.transport.socket.BusBase.handleGlobally(BusBase.java:386)
    at rsb.transport.socket.BusBase.handleGlobally(BusBase.java:409)
    at rsb.transport.socket.BusBase.handleOutgoing(BusBase.java:416)
    at rsb.transport.socket.RefCountingBus.handleOutgoing(RefCountingBus.java:118)
    at rsb.transport.socket.SocketOutConnector.push(SocketOutConnector.java:117)
    at rsb.eventprocessing.DefaultOutRouteConfigurator.publishSync(DefaultOutRouteConfigurator.java:91)
    at rsb.Informer$StateActive.send(Informer.java:186)
    at rsb.Informer$StateActive.send(Informer.java:195)
    at rsb.Informer.publish(Informer.java:337)

This error message is not true in this case: "Probably the other end point crashed."

WARNING: Error while reading a new notification from the bus connection. Shutting down. Probably the other end point crashed.
java.net.SocketException: Socket closed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:170)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:385)
    at rsb.transport.socket.BusConnectionBase.readCompleteBuffer(BusConnectionBase.java:217)
    at rsb.transport.socket.BusConnectionBase.readLength(BusConnectionBase.java:239)
    at rsb.transport.socket.BusConnectionBase.readNotification(BusConnectionBase.java:255)
    at rsb.transport.socket.BusBase$ReceiveThread.doOneNotification(BusBase.java:113)
    at rsb.transport.socket.BusBase$ReceiveThread.run(BusBase.java:166)

Associated revisions

Revision cced8e22
Added by J. Wienke almost 5 years ago

Do not disconnect sockt transport on interrupt

Prevent the socket transport from degrading in case publish is called
with an active interruption. This is achieved by sending the outgoing
notifications in a worker thread instead of the calling thread.

  • src/main/java/rsb/transport/socket/BusConnectionBase.java:
    Add a single threaded executor for sending notifications to ignore
    interruptions for this task
  • src/test/java/rsb/transport/socket/BusRoundtripTest.java:
    Extract ResultWaiter into a distinct file for reuse
  • src/test/java/rsb/transport/socket/ResultWaiter.java:
    Extracted from BusRoundtripTest
  • src/test/java/rsb/transport/socket/SendInterruptTest.java:
    New test for the issue

fixes #2670

Revision 4b700e91
Added by J. Wienke almost 5 years ago

Do not disconnect sockt transport on interrupt

Prevent the socket transport from degrading in case publish is called
with an active interruption. This is achieved by sending the outgoing
notifications in a worker thread instead of the calling thread.

  • src/main/java/rsb/transport/socket/BusConnectionBase.java:
    Add a single threaded executor for sending notifications to ignore
    interruptions for this task
  • src/test/java/rsb/transport/socket/BusRoundtripTest.java:
    Extract ResultWaiter into a distinct file for reuse
  • src/test/java/rsb/transport/socket/ResultWaiter.java:
    Extracted from BusRoundtripTest
  • src/test/java/rsb/transport/socket/SendInterruptTest.java:
    New test for the issue

refs #2670

(cherry picked from commit cced8e22f723253b860cbaa42f9ea1668121fb9a)

History

#1 Updated by J. Moringen almost 5 years ago

  • Tracker changed from Bug to Enhancement
  • Project changed from RSB Coordinate Transform to Robotics Service Bus
  • Category set to Socket Transport
  • Target version changed from rsb-0.13 to rsb-0.16

#2 Updated by M. Pohling almost 5 years ago

Any updates so far?

#3 Updated by J. Moringen almost 5 years ago

M. Pohling wrote:

Any updates so far?

I think we agreed that you should discuss the issue with Johannes.

#4 Updated by J. Wienke almost 5 years ago

Can you provide a minimalized test case for this behavior? It is quite hard to interrupt something during a usually very short send operation and I don't know how to test this without an example.

#5 Updated by J. Wienke almost 5 years ago

  • Status changed from New to In Progress
  • Assignee set to J. Wienke

#6 Updated by J. Wienke almost 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF