Open oberstet opened 5 years ago
I bumped into this with long blocking callees last week. If you cancel the call while the callee is blocking you are getting the ProtocolError
as well.
Reproducer looks like this (sorry, still contains some bits of our testing infrastructure ...), sessions are running over websocket.
@pytest.mark.asyncio
async def test_autobahn_issue_1127(event_loop, session):
"""reproducer for issue 1127
Seems like cancelling calls into blocking callees is causing ProtocolError
Steps to reproduce
- Start a session for the callee on a separate subprocess and registers a long blocking (time.sleep(long_time))
procedure.
- call the long blocking procedure with a timeout << long_time
"""
# start helper session with long blocking procedure, any long blocking procedure should do ...
session_with_long_blocking_procedure = await create_subprocess_exec(
sys.executable,
_autobahn_issue1127.__file__
)
blocking_component_ready = event_loop.create_future()
session.subscribe(blocking_component_ready.set_result, 'autobahn.issue1127.long_blocking')
await blocking_component_ready
# helper session is up and running
try:
await wait_for(session.call('autobahn.issue1127.long_blocking'), 1) # impatient caller
except TimeoutError:
pass
# wait for the helper session to shut-down (exception is raised when the callee returns)
await session_with_long_blocking_procedure.wait()
hard killing a caller results in a callee traceback (on container components over rawsocket):