File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -768,10 +768,15 @@ async def _async_poll_for_reply(
768
768
) -> dict [str , t .Any ]:
769
769
msg : dict [str , t .Any ]
770
770
assert self .kc is not None
771
- new_timeout : float | None = None
772
771
if timeout is not None :
773
772
deadline = monotonic () + timeout
774
773
new_timeout = float (timeout )
774
+ else :
775
+ # if we call shell_channel.get_msg with None timeout value, sometimes will
776
+ # block current execution forever so need pass a timeout value, so we
777
+ # need give a default value and reset the value when timeout value exhausted
778
+ deadline = monotonic () + 5
779
+ new_timeout = float (5 )
775
780
error_on_timeout_execute_reply = None
776
781
while True :
777
782
try :
@@ -800,7 +805,10 @@ async def _async_poll_for_reply(
800
805
new_timeout = max (0 , deadline - monotonic ())
801
806
except Empty :
802
807
# received no message, check if kernel is still alive
803
- assert timeout is not None
808
+ if timeout is None :
809
+ deadline = monotonic () + 5
810
+ new_timeout = float (5 )
811
+ continue
804
812
task_poll_kernel_alive .cancel ()
805
813
await self ._async_check_alive ()
806
814
error_on_timeout_execute_reply = await self ._async_handle_timeout (timeout , cell )
You can’t perform that action at this time.
0 commit comments