This MR avoids a very subtle bug that is hard to repeat consistently but that, to my understanding, boils down to this issue:
if the shared array buffer is not changed but notified as "nothing to return" without an explicit value set to its index [0] then Atomics.wait(sb, 0, 0, delay)might fail unexpectedly without any warning whatsoever
if the shared array buffer has an explicit value set at index [0] then everything always works as expected
if the remote function returns a value, hence it assign some length to the [0] it always works too
I have no idea if it's worth it to me to file a bug to all vendors as I think this is an intended behavior.
Changes
be sure that if the remote call does not return anything (undefined) a value at index [0] is set as -1 so that negative result length means no further actions need to be performed
when the length is indeed less than zero, early return without asking for data to unserialize
This MR avoids a very subtle bug that is hard to repeat consistently but that, to my understanding, boils down to this issue:
[0]
thenAtomics.wait(sb, 0, 0, delay)
might fail unexpectedly without any warning whatsoever[0]
then everything always works as expected[0]
it always works tooI have no idea if it's worth it to me to file a bug to all vendors as I think this is an intended behavior.
Changes
undefined
) a value at index[0]
is set as-1
so that negative result length means no further actions need to be performedlength
is indeed less than zero, early return without asking for data to unserialize