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
The code transmitting "ready!" assumes that it may never receive a ready signal from the opposite side when it is ready.
Normally, this is OK, and the flow is roughtly:
(A) comes online, sends "ping"
(B) not online yet, "ping" lost.
(B) comes online, sends "ping"
(A) receives B's ping; ready=true; sends "pong"
(B) receives A's pong; ready=true
However, this assumption can fail when A+B come online around the same time:
(A) comes online, sends "ping"
(B) comes online, sends "ping"
(B) receives A's ping; ready=true; sends "pong"
(A) receives B's ping; ready=true; sends "pong"
(B) receives A's pong but is ready throws exception
(A) receives B's pong but is ready throws exception
Notably, this can happen because there's no guarrantee of a single thread of execution across windows/frames/web-worker, and even if there were, there is no guarrantee that execution of a postMessage handler is immediately after the sending of a message - there may simply be non-stop execution or other event handers which cause (B) to come online before the message is handled.
Fix: don't throw an exception when this happens.
The text was updated successfully, but these errors were encountered:
The code transmitting "ready!" assumes that it may never receive a ready signal from the opposite side when it is ready.
Normally, this is OK, and the flow is roughtly:
(A) comes online, sends "ping"
(B) not online yet, "ping" lost.
(B) comes online, sends "ping"
(A) receives B's ping; ready=true; sends "pong"
(B) receives A's pong; ready=true
However, this assumption can fail when A+B come online around the same time:
(A) comes online, sends "ping"
(B) comes online, sends "ping"
(B) receives A's ping; ready=true; sends "pong"
(A) receives B's ping; ready=true; sends "pong"
(B) receives A's pong but is ready throws exception
(A) receives B's pong but is ready throws exception
Notably, this can happen because there's no guarrantee of a single thread of execution across windows/frames/web-worker, and even if there were, there is no guarrantee that execution of a postMessage handler is immediately after the sending of a message - there may simply be non-stop execution or other event handers which cause (B) to come online before the message is handled.
Fix: don't throw an exception when this happens.
The text was updated successfully, but these errors were encountered: