You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description
When running a simple connection and disconnection using Bun, the process remains active indefinitely. I waited for more than 5 minutes, but it did not terminate.
This behavior suggests that some resources might not be properly disposed of in Bun, whereas Node handles it differently (perhaps more effectively).
Expected behavior
After calling connection.close(), the process should terminate.
Actual behavior
Even after closing the connection, the process continues to hang indefinitely.
Error message/stack trace
N/A
Any other details that can be helpful
After investigating the issue, I suspect that the securePair sockets (securePair.encrypted and securePair.cleartext) are not being properly destroyed when the socket closes.
Interestingly, this issue does not occur when using Node.js, which may indicate an underlying problem with lingering open sockets that is not as noticeable in Node.
I was able to resolve the issue by manually destroying the sockets when the end event is emitted on the connection:
connection.on("end",function(err){if(err){console.log("end error: ",err);return;}// 👇 This fixes the issueconnection.messageIo.securePair.encrypted.destroy();connection.messageIo.securePair.cleartext.destroy();console.log("end OK");});
Proposed Fix
If you believe this fix is appropriate, I can submit a PR. The proposed change involves explicitly destroying the secure pair sockets when the main socket emits end, close, or error.
Suggested code modification in tedious/src/message-io.ts:
// Handle main socket closurethis.socket.on('end',this.cleanupSecurePair);this.socket.on('error',this.cleanupSecurePair);this.socket.on('close',this.cleanupSecurePair);
Would this approach be acceptable? If so, I’d be happy to submit a PR.
Comparing.connection.with.Node.and.Bun.mp4
The text was updated successfully, but these errors were encountered:
Software versions
Additional Libraries Used and Versions
Table schema
N/A
Connection configuration
Problem description
When running a simple connection and disconnection using Bun, the process remains active indefinitely. I waited for more than 5 minutes, but it did not terminate.
This behavior suggests that some resources might not be properly disposed of in Bun, whereas Node handles it differently (perhaps more effectively).
Expected behavior
After calling
connection.close()
, the process should terminate.Actual behavior
Even after closing the connection, the process continues to hang indefinitely.
Error message/stack trace
N/A
Any other details that can be helpful
After investigating the issue, I suspect that the
securePair
sockets (securePair.encrypted
andsecurePair.cleartext
) are not being properly destroyed when the socket closes.Interestingly, this issue does not occur when using Node.js, which may indicate an underlying problem with lingering open sockets that is not as noticeable in Node.
I was able to resolve the issue by manually destroying the sockets when the end event is emitted on the connection:
Proposed Fix
If you believe this fix is appropriate, I can submit a PR. The proposed change involves explicitly destroying the secure pair sockets when the main socket emits
end
,close
, orerror
.Suggested code modification in
tedious/src/message-io.ts
:Define a cleanup method:
Attach it to the socket lifecycle events:
Would this approach be acceptable? If so, I’d be happy to submit a PR.
Comparing.connection.with.Node.and.Bun.mp4
The text was updated successfully, but these errors were encountered: