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

Uncaught exception in ext/websocket/01_websocket.js:507:13 #16676

Closed
quentinadam opened this issue Nov 16, 2022 · 8 comments
Closed

Uncaught exception in ext/websocket/01_websocket.js:507:13 #16676

quentinadam opened this issue Nov 16, 2022 · 8 comments
Assignees
Labels
bug Something isn't working correctly

Comments

@quentinadam
Copy link

[Using Deno 1.28.0]

I frequently have the following exception that kills my program:

error: Uncaught (in promise) Error: IO error: Broken pipe (os error 32): Broken pipe (os error 32)
at async deno:ext/websocket/01_websocket.js:507:13

I had a look at the source code, and it seems that this set of lines should be included in a try-catch block:

await core.opAsync("op_ws_send", this[_rid], {

await core.opAsync("op_ws_send", this[_rid], {
  kind: "ping",
});
@bartlomieju bartlomieju added the bug Something isn't working correctly label Nov 16, 2022
@quentinadam
Copy link
Author

Hello,

I continue to have this bug which is quite annoying.

Here is the stack trace in In deno 1.29.1:

Error 'IO error: Broken pipe (os error 32)' contains boxed error of unknown type:
  Io(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
  Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }
error: Uncaught (in promise) Error: IO error: Broken pipe (os error 32): Broken pipe (os error 32)
    at async deno:ext/websocket/01_websocket.js:514:13

@bartlomieju
Copy link
Member

Does this problem still happen on the latest version?

@quentinadam
Copy link
Author

quentinadam commented Apr 14, 2023

I would need to check, but it's slightly annoying because I can't upgrade past Deno 1.31 because otherwise I am getting memory leak errors every few hours on my long running process. (#18369).

@crowlKats
Copy link
Member

@quentinadam does this still occur?

@bartlomieju
Copy link
Member

@quentinadam You can upgrade to Deno v1.33 (or later for the time being) that works around the memory leak - we're still waiting on V8 11.7 release to properly fix the problem from that issue.

@milaz
Copy link
Contributor

milaz commented Jul 18, 2023

I have closed #17823, as it is most likely a duplicate of this issue.
However, there may be some useful additional info.

While everyone here is talking about a reproduction, I'd like to note that you can see a problem just by looking at the code.
ext/websocket/01_websocket.js line 505, setTimeout. What happens when there is an uncaught exception in a function called from setTimout? A crash. Line 507, await core.opAsync("op_ws_send", ...) a function that can raise an exception. And it does, at the most inconvenient moment.

I would be extremely grateful if you finally wrapped that function with try .. catch block, please.
I would have done it myself, but I still believe you have more knowledge to decide what amount of adjacent code should go into that block, what kind of exceptions does opAsync raise and what to do best when you are handling them, especially regarding the state of the socket.

There are two setTimeouts there with no exception handlers. It would be great to check those out in a single fix.

@littledivy
Copy link
Member

Hi, This was fixed in the latest release (1.36.1). Feel free to reopen if its still happening.

@jflatow
Copy link
Contributor

jflatow commented Oct 4, 2023

Has there been a regression? I'm using 1.37.1 and getting error: Uncaught (in promise) TypeError: Broken pipe (os error 32) at async ext:deno_websocket/01_websocket.js:517:15 on a websocket over tls (but not without)

EDIT: Actually I just discovered #18977, which looks the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

6 participants