-
Notifications
You must be signed in to change notification settings - Fork 12
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
workaround for Mutex::Lock not being signal-safe #24
Conversation
LGTM |
Is this regarding https://github.com/nearform/node-clinic-bubbleprof/issues/22 ? If it's not and I've misunderstood the intention, ignore this comment :-) If so, testing it against the issues there (node 9.4.0 and Windows 10):
Screenshot of example empty cluster node expanded in dev tools: |
e84a006
to
eebf9b5
Compare
Also in my testing it seems like the trace buffer is properly flushed after the process exit triggers StopTracingAgent - the problem is, our 'exit' callback doesn't wait for everything in the inner process exit to have completed (in particular, the write to the log file). This is why the setTimeout hack works - the trace buffer is flushing, and we do get the buffer data if we wait for it. The problem is how can we properly wait for it. |
What case are you running?
Did you verify this by removing the rename code? It makes no sense at all. My guess is that you are assuming the data is written but actually it isn't. Rename or not.
Yes, this is the flushing issue caused by "Mutex::Lock not being signal-safe".
I seriously doubt that, because we wait until the process exits (meaning no code can be executed). It could be that on Windows the If this is the case |
Test cases:
I'll run the same tests in my Ubuntu VM, see if it's an OS thing. |
Works perfectly on my Ubuntu VM. So, LGTM and I can work around the issue still existing in Windows for now.
|
Thanks. Then it properly have something to do with signals on windows ( or lack of that ;) ) |
Based on your suggestion of removing the rename code I ran some quick tests in Windows 10 / Node 9.4.0 with the 1: On both branches (sigint-hack and Master) with setTimeout:
2: On both branches (sigint-hack and Master) without setTimeout:
3: With only the first commit from this branch applied and without setTimeout:
4: On this branch (sigint-hack) with
So shall I add a commit to this branch like below (will make this workaround fix both Windows and Linux/Mac)? Or as a seperate PR after this one is merged?
[EDIT] Curiously, that change causes nothing to happen at all to happen in Windows, but this below works perfectly. No idea why having an event handler that doesn't do anything would make all the difference (maybe the handler intercepts it from passing through automatically):
|
Right. We forgot to apply that a fix for that in bubbleprof too. I added a commit for that. |
dbc47c8
to
163d9ba
Compare
see: nodejs/node#18476
/cc @mafintosh @AlanSl