-
Notifications
You must be signed in to change notification settings - Fork 1.2k
childprocess.spawn breaks process.context #1807
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
Comments
@bajtos, do you have any ideas about this? |
Not really. The |
Meanwhile any ideas for stable workaround? |
You can bind your callback to the correct current context, as is proposed in loopbackio/loopback-connector#56. That way the current context will be correctly restored after your child process finishes. |
You can also try the new additions in loopback-context, e.g. https://github.com/strongloop/loopback-context#bind-for-concurrency We have removed |
Interestingly after calling an imagemagick function from a models remotemethod, after successful callback loopback.getCurrentContext() returns null.
Imagemagick spawns a child process and an event listener does the callback function call.
from imagemagick.js
where std.finish() simply does the callback
Well I am not sure where is this relates to the getCurrentContext, however in the loopback source there are corresponding lines from current-context.js
It seems that loopback simply stores values in the process.context
And more interestingly BEFORE calling the child.spawn command we have a different context object after the child finishes and exits.
Before the call we have a process.context object like this:
but after the child process exits the process.context changes to:
Any ideas on what could break the context object?
The text was updated successfully, but these errors were encountered: