-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node crash with tracing enabled #46376
Comments
The problem seems to be caused by this change: 08950fc. |
santigimeno
added a commit
to santigimeno/node
that referenced
this issue
Jan 27, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: nodejs#46376.
santigimeno
added a commit
to santigimeno/node
that referenced
this issue
Jan 27, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: nodejs#46376
Yes, i think #46380 can fix this. or we can check if the threadpool exsits before calling |
nodejs-github-bot
pushed a commit
that referenced
this issue
Jan 31, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
ruyadorno
pushed a commit
that referenced
this issue
Feb 1, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol
pushed a commit
that referenced
this issue
Mar 3, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol
pushed a commit
that referenced
this issue
Mar 3, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol
pushed a commit
that referenced
this issue
Mar 5, 2023
Otherwise there might be pending tracing fs writes which lead to a crash because the libuv threadpool is already gone. Fixes: #46376 PR-URL: #46380 Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v18.13.0
Platform
Linux devloop-Surface-Laptop-4 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
This was originally encountered when trying to capture a trace of the TypeScript compiler running, however I can also reliably reproduce the same crash with a much simpler invocation that doesn't require setting up/installing a complex project.
$ node --trace-events-enabled /usr/lib/node_modules/npm/bin/npm-cli.js set init-license MIT Aborted (core dumped)
How often does it reproduce? Is there a required condition?
See "additional information" below for a possible condition. From my experience, the commands that cause a crash - like the one from above - reproduce 100% of the time. That said, not all invocations with tracing enabled will reproduce the issue.
What is the expected behavior?
The node process does not crash and the trace file is written to disk in its entirety
What do you see instead?
On top of that, the trace file contains incomplete JSON
Additional information
Running under the debugger, I see a crash (
abort
) with this stack:The code is calling
abort
because acquiring a mutex is failingIf I look at other threads, the main thread is executing here:
My non-expert guess is that the JS code calls
process.exit
and the tear-down of state leads to a race condition where the mutex is trying to be used after it has been destroyed. That said, trying to repro this with a simple example that just callsprocess.exit(0)
does not produce the same crash, so I'm guessing that there's at least some amount of unpredictability in the repro (or my assessment could be wrong).I suppose it's also worth mentioning that I haven't observed this failure on Windows, but that's perhaps because
EnterCriticalSection
hasvoid
return type, along with the fact that callingEnterCriticalSection
afterDeleteCriticalSection
doesn't necessarily cause problems because a lot of the necessary state "lives" inside of theCRITICAL_SECTION
object.The text was updated successfully, but these errors were encountered: