Crash on Deno Deploy: Connection reset by peer
See original GitHub issueConnectionReset: Connection reset by peer (os error 104)
at async read (deno:ext/net/01_net.js:21:19)
at async BufReader.read (https://deno.land/std@0.118.0/io/buffer.ts:314:18)
at async BufReader.readFull (https://deno.land/std@0.118.0/io/buffer.ts:343:28)
at async WireProtocol.receive (https://deno.land/x/mongo@v0.29.0/src/protocol/protocol.ts:77:34)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
feat: Automatic reconnect · Issue #278 · denodrivers/mongo · GitHub
Many mongodb drivers implement a reconnect for when a connection to remote server is dropped. ... Crash on Deno Deploy: Connection reset by...
Read more >Thread: Applicationl Crash - Connection reset by peer
Hi, I am using Postgresql 7.4.3 running on RedHat Linux 2.4.7. My Application is coded in C. I am using libpq functions inorder...
Read more >Connecting to Postgres | Deploy Docs
Setup Postgres · Select a name, password, and region for your database. · Click "Create new project". · Once the project is created,...
Read more >Heroku PostgreSQL Connection reset by peer - Stack Overflow
Your application happened to crash while connected to postgres, and did not clean up its connection to the database. Postgres noticed that the...
Read more >Connection reset by peer:Socket write error — oracle-tech
Hi, I am running my application in weblogic server 8.1,when i deploy the application in exploded format i get the following error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
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.
Because I use DangoDB and am not very knowledgeable on MongoDB, this was the easiest way for me to accomplish it for me.
A better solution will need to be built.
I don’t know how this will affect users of
Deno Deploysince I am not familiar with the service.EDIT: Here’s a little overview on when my app crashed (red section) vs after the “fix” (green section). Missing dots on the graph represent moments when the app crashed. As one can see, the crashing was pretty frequently before the fix and after it, it hasn’t crashed a single time yet.
Update after ~8 days
It’s been about 8-days now since I’ve added this and I haven’t had a single crash yet.
So it does seem that implementing some kind of keepalive may help solve this issue.