-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Empty log line on worker error #945
Empty log line on worker error #945
Comments
Resolved. Adding a try/catch block in workerAdapter.js solves the issue:
|
Issue sometimes still persists even with aforementioned fix. Trying to replicate. |
I replicated the issue. When the error is thrown while inside the parentPort.addListener 'message' context, no error message is shown on the console. I have updated the error repository accordingly: https://github.com/teh-mICON/ts_worker_error/blob/master/worker.ts#L6 Workaround for now is obviously to try/catch the entire context. |
This looks like an issue with error handling, not with ts-node. Does the issue occur if your worker.ts is renamed to worker.js (and TypeScript syntax removed) and you do not use ts-node? |
No. The basically exact same code with vanilla JS (without the workerAdapter.js in between) works as expected:
|
I narrowed it down to an issue in source-map-support, one of our dependencies. https://repl.it/@AndrewBradley/ts-nodeissues945 When source-map-support is installed in the worker, the worker doesn't emit error events to the main thread properly. If this makes sense, you can file an issue at https://github.com/evanw/node-source-map-support/issues EDIT: this code might be the culprit: https://github.com/evanw/node-source-map-support/blob/master/source-map-support.js#L475-L486 |
Well, I guess I could but it would actually make more sense if you did it since you could give a much better description of the actual problem. I'm not really sure how the problem arises from the source maps or how to provide steps to reproduce. (Other than the one given in this post which is not very helpful I think) |
I don't have time unfortunately.
The info I gave you should be all you need for the source-map-support
maintainers to take it from here. You can copy-paste what I posted here
and ping me on the ticket if you want.
…On Mon, Jan 20, 2020, 6:30 AM Michael Saller ***@***.***> wrote:
Well, I guess I could but it would actually make more sense if you did it
since you could give a much better description of the actual problem. I'm
not really sure how the problem arises from the source maps or how to
provide steps to reproduce. (Other than the one given which is not very
helpful I think)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#945?email_source=notifications&email_token=AAC35OFDIRWHWAJA3OY3DJLQ6WDMDA5CNFSM4KISO4M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJMKAEY#issuecomment-576233491>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OGSYYXRGTBC3JKLGVTQ6WDMDANCNFSM4KISO4MQ>
.
|
Node.js Worker threads don’t handle `uncaughtException` the same way that the main thread does. The shim does not apply/make sense here, but breaks error handling support in unexpected ways instead. Fixes: evanw#268 Fixes: TypeStrong/ts-node#945
Node.js Worker threads don’t handle `uncaughtException` the same way that the main thread does. The shim does not apply/make sense here, but breaks error handling support in unexpected ways instead. Fixes: evanw#268 Fixes: TypeStrong/ts-node#945
Just ran into this too, would be cool if you could verify that evanw/node-source-map-support#269 does fix the issue as described in #945 (comment) (and it fixes a similar issue for me locally). |
Merged the PR from @addaleax and published as |
Node.js Worker threads don’t handle `uncaughtException` the same way that the main thread does. The shim does not apply/make sense here, but breaks error handling support in unexpected ways instead. Fixes: evanw/node-source-map-support#268 Fixes: TypeStrong/ts-node#945
Error when trying to create faulty worker
Description
When trying to create a new worker that has errors, an empty log line is printed to the console instead of the actual error.
Replication
For replication, see this repository: https://github.com/teh-mICON/ts_worker_error
run via
ts-node start.ts
ornpm run start
Error when directly invoking worker.ts
Output when Invoking start.ts
Additional notes
An empty log line is also created on runtime exception, if code compiled correctly
The text was updated successfully, but these errors were encountered: