Closed dalehenrich closed 3 years ago
It looks like the methods exist in the FFI for checking for an unexpected return from the GCI call. The launcher (SpkGCIConnectionProfile) makes a non-blocking call, but never checks whether there was a return from that call. The launcher should set up a Process that polls every (five seconds?) for a return from the GCI, and kill the connection with an error if it gets one. Or could log the error and try to restart the connection. I don't think there's a generic way to do it from within the FFI.
What we need is something like this:
[
| done delay |
delay := Delay forSeconds: 1.
done := false.
[ done ] whileFalse:[
(sess getNbCallStatusWithMaxDelay: 0) "Poll socket without blocking"
ifTrue:[ sess blockAndFetchNbResult. "Fetch result or raise error"
done := true. ]
ifFalse:[ delay wait].
].
] fork
I'm not sure how to code the waiting loop in Pharo so it does the right thing. After the ifTrue: block the forked process should exit. Anyone want to help me take that on?
I've added code to SpkGCIConnectionProfile which calls a new method in GsSession startWaitForResultThread . This forks a wait thread and checks for a result from the NB execution every 1 second and raises an error if it detects one. Please give it a try.
Confirm that I'm getting a GCI error during connect sequence, so mission accomplished!
In Internal issue 49494, when an unintended GCIError was signalled while running in Pharo over FFI, the gem would hang ... @ericwinger reproduced the problem running with a topaz-based server and we were able to get the error message and a stack ... Hanging is not a good way to fail so we ought at least log the error message and shut down the connection similar to what happens when the connection is lost ...