mozilla / chat.mozillafoundation.org

Open source Slack-alternative in Golang and React - Mattermost
http://mattermost.org
Other
5 stars 6 forks source link

Postgres doesn't close connections, resulting in downtime #59

Closed alanmoo closed 8 years ago

cadecairos commented 8 years ago

What I know: When mattermost is shut down ( see this article on restart activities done by the dyno manager ), [some?/all?] of the idle connections to Heroku PG remain idle and don't timeout/close.

What I've tried: I was hoping that this was a case where the dyno managers restarts were causing this. I boot up mattermost using a bash script (it's complicated, ask me sometime!), and I thought that it may be killing that process and not stopping the child process gracefully. I added a trap to the bash script that intercepts SIGKILL and sends it to the mattermost process, in the hopes that mattermost would gracefully close connections to the database. That does not seem to have worked though, since I've still seen the database connection count hit 20 since deploying that script - although, it does crash less often, I think... Might just be wishful thinking

cadecairos commented 8 years ago

possibly related? https://groups.google.com/forum/#!topic/golang-nuts/RfTp9XVryEM

gideonthomas commented 8 years ago

We haven't seen this issue recently and it's hard to reproduce. If we encounter it again, we can re-open.