-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Crash on Deno Deploy: Connection reset by peer #323
Comments
Same error in Deno 1.20.3, mongo 0.30.0 (not deploy, regular Ubuntu server, mongodb 5.0.6 running locally on the same PC)
Maybe automatic reconnect could handle these situations, if we ever get those? #278 |
Same here on Docker (using the
|
I did manage to "circumvent" this issue for now by having my app make a small query every 5 seconds (might want to increase this but it'll do for now), keeping the connection alive. I don't know how this will affect users of EDIT: Here's a little overview on when my app crashed (red section) vs after the "fix" (green section). Update after ~8 daysIt's been about 8-days now since I've added this and I haven't had a single crash yet. |
While developing locally I'm connecting to a remote mongo instance, and I am getting this when I close my laptop lid for a while. globalThis.addEventListener("unhandledrejection", e => {
const err = e.reason;
if (err instanceof Deno.errors.ConnectionReset || err instanceof Deno.errors.BrokenPipe) {
if (err.stack?.includes("https://deno.land/x/mongo")) {
console.warn("Database connection has been lost, restart the dev script in order to reconnect the database.");
e.preventDefault();
}
}
}); The database connection stays broken but at least my development script doesn't crash. |
This is indeed a problem with keepalive, which also exists in other database drivers of deno. I have recently used redis and pgsql in a production environment. Sending heartbeat requests regularly is simple and effective. Of course, this should also be added as a feature of the driver library. |
The text was updated successfully, but these errors were encountered: