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
I did some digging into this issue. So far, it appears that a normal CI run will reliably reproduce this error. Occasionally, they will succeed but that seems to be more of an exception than the norm.
Looking at test/index.js, the log of "Running test async_worker" should come after the the Promise for the async_progress_worker test resolves. Since it's not, I think it is still async_progress_worker hanging. There could be some random deadlocking / mutex stuff going on when running the full test suite vs a subset of tests that makes it seem like everything is right when in actuality things are... not.
I remember awhile back we had a similar flakey test. It was due to the missing predicate condition for condition_variable.wait() calls: #1168 to fix this issue #1150 that has a very similar test timeout failure.
I noticed we have some places in async_progress_worker that use condition variables with no predicate, eg:
Maybe this is the cause? If you can start with addressing this one and see if it fixes the hang. If so, we should look into changing the other places that use condition variables with no predicate:
Activity
JckXia commentedon Mar 16, 2023
I did some digging into this issue. So far, it appears that a normal CI run will reliably reproduce this error. Occasionally, they will succeed but that seems to be more of an exception than the norm.
However, when I tried to run just this particular test using
node16on X86 (https://github.com/JckXia/node-addon-api/actions/runs/4440582410/jobs/7794559762), it will pass with flying colors each time. I thoughtasync_progress_queue_workerwas the confounding factor but that doesn't seem to make much of a difference.Does anyone have any other ideas that I could explore?
Issues to persist when we are running on X86 only, but against all node versions: https://github.com/JckXia/node-addon-api/actions/runs/4440781888/jobs/7795016181
KevinEady commentedon Mar 16, 2023
Hi @JckXia ,
Thanks for looking into this!
Looking at
test/index.js, the log of "Running test async_worker" should come after the the Promise for theasync_progress_workertest resolves. Since it's not, I think it is stillasync_progress_workerhanging. There could be some random deadlocking / mutex stuff going on when running the full test suite vs a subset of tests that makes it seem like everything is right when in actuality things are... not.I remember awhile back we had a similar flakey test. It was due to the missing predicate condition for
condition_variable.wait()calls: #1168 to fix this issue #1150 that has a very similar test timeout failure.I noticed we have some places in
async_progress_workerthat use condition variables with no predicate, eg:node-addon-api/test/async_progress_worker.cc
Lines 38 to 42 in 0b53d88
Maybe this is the cause? If you can start with addressing this one and see if it fixes the hang. If so, we should look into changing the other places that use condition variables with no predicate:
node-addon-api/test/threadsafe_function/threadsafe_function.cc
Lines 92 to 94 in 0b53d88
node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.cc
Lines 88 to 90 in 0b53d88
JckXia commentedon Mar 16, 2023
Hey @KevinEady! Thank you, I added a wait condition and it indeed seems to have resolved the issue.
#1297