Back to the main page.

Bug 2309 - Java Buffer Client : bug fix for freeze when buffer disconnects unexpectedly

Status ASSIGNED
Reported 2013-10-07 13:31:00 +0200
Modified 2015-02-11 10:43:08 +0100
Product: FieldTrip
Component: realtime
Version: unspecified
Hardware: All
Operating System: All
Importance: P3 enhancement
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Jason Farquhar - 2013-10-07 13:31:00 +0200

Created attachment 526 (Context) diff output to patch the java bufferclient directory relative to SVN version r8582 The original java code had 2 failure modes when the buffer disconnected unexpectedly. 1) If the buffer disconnected when reading/writing a message on the socket then the java would freeze in an infinite loop as it did not detect this condition. 2) If the buffer disconnected between reading/writing messages this would not be detected *until* reading/writing the next message resulting in the infinite loop mentioned in bug 1 above. 3) The isconnected test would return true even if the remote end was actually disconnted as the socket was still connected. The fixes to these issues are 2 fold: 1) In the read/write message code there is an additional check for the number of characters read/written. If this is <0 this indicates the remote end has disconnected and a IO exception is raised. 2) In the isConnected test we additionally try to read a single character from the socket. This will fail if the remote end has disconnected giving a reliable test for this condition. Other Enhancements: 1) Added an auto-reconnect functionality. If this flag is set then a disconnect detected before reading/writing a message will first try to automatically re-connect to the previous buffer information. 2) Added array value event type constructors to BufferEvent 3) Fixed byte-order issue with the use of the slice function. Attached are the diff's w.r.t. SVN version r8582