Skip to content
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

setTimeout().unref() is not a function #140624

Closed
bpasero opened this issue Jan 13, 2022 · 13 comments
Closed

setTimeout().unref() is not a function #140624

bpasero opened this issue Jan 13, 2022 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug telemetry Telemetry system issues verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jan 13, 2022

Seeing in shared process:

bootstrap-window.js:253 TypeError: setTimeout(...).unref is not a function
    at IncomingMessage.<anonymous> (Sender.ts:138)
    at IncomingMessage.emit (events.js:327)
    at endReadableNT (internal/streams/readable.js:1327)
    at processTicksAndRejections (internal/process/task_queues.js:80)

Originates from Sender.ts of app insights it seems.

image

https://ticino.blob.core.windows.net/sourcemaps/753319a08f8e74700b1dba3a29bf0a6af7c2953f/node_modules/applicationinsights/Library/Sender.ts

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug telemetry Telemetry system issues labels Jan 13, 2022
@lramos15
Copy link
Member

Hmmm, unref has been around in node for awhile. Are you doing anything special? It seems like a lot of the errors with unref happen when you accidentally execute in a browser based context rather than node.

@bpasero
Copy link
Member Author

bpasero commented Jan 15, 2022

Nothing special afaik, just show the shared process window via F1:

image

Keep in mind that the shared process is a browser window, so setTimeout does not return a function but a number!

image

@lramos15 lramos15 added this to the January 2022 milestone Jan 19, 2022
@bpasero bpasero added the verified Verification succeeded label Jan 25, 2022
@bpasero
Copy link
Member Author

bpasero commented Jan 25, 2022

I still see this in exploration builds but not insiders 🤷

@lramos15
Copy link
Member

Is there something special about exploration builds? I just added a try catch

@bpasero
Copy link
Member Author

bpasero commented Jan 26, 2022

@lramos15 yeah maybe how uncaught exceptions are handled and reported. This one you cannot really catch as it happens from an event handler:

image

@lramos15
Copy link
Member

Yeah like I said not sure what we should do here as one module expects node and another module expects window and the shared process is a bit in between

@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2022
@bpasero bpasero reopened this Apr 14, 2022
@bpasero
Copy link
Member Author

bpasero commented Apr 14, 2022

This is still happening.

Btw found microsoft/ApplicationInsights-node.js#367. Maybe we need to contribute a PR.

@bpasero bpasero removed this from the January 2022 milestone Apr 14, 2022
@bpasero bpasero removed the verified Verification succeeded label Apr 14, 2022
@lramos15
Copy link
Member

Is the issue saying we're trying to use the node SDK in the electron renderer?

@bpasero
Copy link
Member Author

bpasero commented Apr 14, 2022

Yeah in the renderer we get the setTimeout variant from DOM and not node.js. I was actually looking into whether we could simply shim the unref() method, but it didn't seem to easy, unless we would overwrite the entire setTimeout method for everyone.

@lramos15
Copy link
Member

Maybe we should be using the web SDK in the renderer then? We use the web telemetry reporter in the /browser/ telemetryService so I'm surprised that we're using the node one in the renderer.

@bpasero
Copy link
Member Author

bpasero commented Apr 14, 2022

Yeah that sounds reasonable. Though the fact that the shared process is a browser window is a bit of a debt issue, eventually we probably want to go away from running it as hidden window and use a pure node.js process once #131798 landed.

Given that, maybe we should just ignore the issue for now until we get to a real node.js process.

@bpasero bpasero closed this as completed Apr 14, 2022
@lramos15
Copy link
Member

lramos15 commented Jun 2, 2022

Going to reopen this since it hasn't really been fixed and Daniel is seeing the issue as well. We are working on switching modules so maybe that will help but still want to keep this as a tracking issue.

@lramos15 lramos15 reopened this Jun 2, 2022
@lramos15 lramos15 added this to the On Deck milestone Jun 2, 2022
@lramos15
Copy link
Member

lramos15 commented Aug 2, 2022

Closing this as we have switched modules

@lramos15 lramos15 closed this as completed Aug 2, 2022
@lramos15 lramos15 modified the milestones: On Deck, August 2022 Aug 2, 2022
@connor4312 connor4312 added the verified Verification succeeded label Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug telemetry Telemetry system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants
@bpasero @connor4312 @lramos15 and others