Skip to content

Commit

Permalink
Revert commits 220b9d4 and 3698c93
Browse files Browse the repository at this point in the history
 The fix in commit 3698c93 to prevent crashes intorduced by commit
 220b9d4 ended up triggering a race condition related to collecting the
 exit status or exit signal information on a process. There's stil an
 issue that needs to be addressed when remote systems don't close the
 channel in a timely manner which can cause problems handling something
 like a KeyboardInterrupt, but the attempted fix seemed to be doing more
 harm than good. Until a different approach can be found, the code has
 been reset back to what it was before these two commits.
  • Loading branch information
ronf committed Sep 6, 2024
1 parent c044221 commit 358c175
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions asyncssh/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def _cleanup(self, exc: Optional[Exception] = None) -> None:

self._close_event.set()

if self._conn and self._recv_state == 'closed': # pragma: no branch
if self._conn: # pragma: no branch
self.logger.info('Channel closed%s',
': ' + str(exc) if exc else '')

Expand Down Expand Up @@ -263,8 +263,7 @@ def _discard_recv(self) -> None:
# If recv is close_pending, we know send is already closed
if self._recv_state == 'close_pending':
self._recv_state = 'closed'

self._loop.call_soon(self._cleanup)
self._loop.call_soon(self._cleanup)

async def _start_reading(self) -> None:
"""Start processing data on a new connection"""
Expand Down Expand Up @@ -413,11 +412,7 @@ def _service_next_request(self) -> None:
handler = cast(_RequestHandler, getattr(self, name, None))

if handler:
if self._session:
result = cast(Optional[bool], handler(packet))
else:
# Ignore requests received after application closes the channel
result = True
result = cast(Optional[bool], handler(packet))
else:
self.logger.debug1('Received unknown channel request: %s', request)
result = False
Expand Down

0 comments on commit 358c175

Please sign in to comment.