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
My understanding of this code is that this code is intended to detect "false positives" in the R_SelectEx that occurs a few lines above; R_SocketWait only cares about its socket being ready to read or write, but if R_SelectEx will also return because other, unrelated, input handlers are ready. If this condition is detected, R_SocketWait executes a single input handler and then begins the loop again, reasonably assuming that executing the handler will cause its file descriptor to go cold.
The input handler installed by later doesn't go cold in many cases, it stays hot until R code stops executing. This means that R_SocketWait will never return, and since it was R code that is indirectly calling R_SocketWait, later's file descriptor will never go cold. So we effectively have deadlock (although interrupting R does work fine).
The expected behavior is that [1] 10 is printed at the console after 2 seconds, then the console prompt returns, then done is printed after 10 seconds.
The text was updated successfully, but these errors were encountered:
There's an incompatibility between later and this piece of code in
R_SocketWait
:https://github.com/wch/r-source/blob/f2a17ffe009aeeee3f2ee769a6114051a2a6678a/src/modules/internet/Rsock.c#L268-L275
My understanding of this code is that this code is intended to detect "false positives" in the
R_SelectEx
that occurs a few lines above;R_SocketWait
only cares about its socket being ready to read or write, but ifR_SelectEx
will also return because other, unrelated, input handlers are ready. If this condition is detected,R_SocketWait
executes a single input handler and then begins the loop again, reasonably assuming that executing the handler will cause its file descriptor to go cold.The input handler installed by later doesn't go cold in many cases, it stays hot until R code stops executing. This means that
R_SocketWait
will never return, and since it was R code that is indirectly callingR_SocketWait
, later's file descriptor will never go cold. So we effectively have deadlock (although interrupting R does work fine).This is a simple repro case:
The expected behavior is that
[1] 10
is printed at the console after 2 seconds, then the console prompt returns, thendone
is printed after 10 seconds.The text was updated successfully, but these errors were encountered: