You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We found a weird edge-case where the current implementation of the Device observable sequence hangs indefinitely following asynchronous termination. To reproduce:
We were able to reproduce the blocking behavior both with OnCompleted and OnError. In this example, the workflow terminates on the first sample from Timer. Crucially, the termination is asynchronous with Device events. The observed behavior is that the workflow terminates but cancellation of the subscription hangs indefinitely (i.e. the workflow running state will never change back to Ready).
On investigation we found it is the call to the Dispose method of the underlying serial port object that hangs. Calling dispose on the serial port from a separate thread is sufficient to resolve the issue, and the serial port will then be successfully closed (and can be reopened again).
The problem with the asynchronous disposal logic is that it changes the currently synchronous semantics of serial port termination. Since disposal is not really synchronous there is a chance the serial port is still open if we either have a Repeat, Retry or restart the workflow quickly.
The text was updated successfully, but these errors were encountered:
glopesdev
changed the title
Cancellation of Device subscription hangs following asynchronous unhandled exception
Cancellation of Device subscription hangs following asynchronous completion or error
Jun 20, 2023
We found a weird edge-case where the current implementation of the
Device
observable sequence hangs indefinitely following asynchronous termination. To reproduce:Example workflow source
We were able to reproduce the blocking behavior both with
OnCompleted
andOnError
. In this example, the workflow terminates on the first sample fromTimer
. Crucially, the termination is asynchronous withDevice
events. The observed behavior is that the workflow terminates but cancellation of the subscription hangs indefinitely (i.e. the workflow running state will never change back to Ready).On investigation we found it is the call to the
Dispose
method of the underlying serial port object that hangs. Calling dispose on the serial port from a separate thread is sufficient to resolve the issue, and the serial port will then be successfully closed (and can be reopened again).The problem with the asynchronous disposal logic is that it changes the currently synchronous semantics of serial port termination. Since disposal is not really synchronous there is a chance the serial port is still open if we either have a
Repeat
,Retry
or restart the workflow quickly.The text was updated successfully, but these errors were encountered: