16

I have 3 Rails applications that all use the same code base. 2/3 of the applications are running fine, but one of them gives me this error:

could not fork new process for connection: Cannot allocate memory

Upon trying to look at the Postgres logs, it is a little more specific:

psql: bin//psql-9.2.1-64bit pv: bin//pv-1.1.4-64bit psql-9.2.1-64bit:
could not fork new process for connection: Cannot allocate memory
could not fork new process for connection: Cannot allocate memory
could not fork new process for connection: Cannot allocate memory
bin/brie: line 146: [: : integer expression expected pg_dump:
bin//pg_dump-9.2.1-64bit psql-9.2.1-64bit:
could not fork new process for connection: Cannot allocate memory
could not fork new process for connection: Cannot allocate memory
could not fork new process for connection: Cannot allocate memory

This is a relatively small app, especially data-wise. I have tried re-pushing everything, I have tried heroku-restart, and Heroku's status page says they're fine. Any help would be appreciated.

Karol Selak
  • 4,248
  • 6
  • 35
  • 65
rpearce
  • 1,720
  • 1
  • 21
  • 29
  • Hours later, the problem seems to have "resolved itself." I am going to leave this question unanswered because, well, I still don't have an answer. What if this happens again? – rpearce Apr 22 '13 at 18:13
  • Are you on a free dyno? Are you on a free database? – Eric Fode Apr 22 '13 at 19:54
  • 1
    This was an isolated incident with that database server. Should be fixed now. If you continue to see it, migrate to a new host with pgbackups: https://devcenter.heroku.com/articles/upgrade-heroku-postgres-with-pgbackups – catsby Apr 22 '13 at 21:27
  • Heroku guys fixed it. I was on free database though. – rpearce Apr 23 '13 at 20:16
  • 1
    I had the same problem an hour ago. Now, everything works fine. Still don't understand why should I migrate to a new host with pgbackups. I am on a free dyno. – mirelon Jun 11 '13 at 12:53
  • Having the same issue now. The database server has been down for over 13 hours, and there is no response from Heroku to the ticket I submitted. – gosha Oct 16 '20 at 11:01

1 Answers1

5

Heroku people fixed it. Their problem

rpearce
  • 1,720
  • 1
  • 21
  • 29
  • Just had a similar problem, was caused by a noisy neighbor using too much memory. – manderson Sep 24 '13 at 14:42
  • 3
    It happened to us today. Unfortunately given the limited control over DB given by Heroku there was nothing we could do. Is there a way to restart DB? – phani Mar 24 '16 at 15:09
  • I haven't done this myself, and it may not address this core problem much, but it looks like you can kill Postgres processes via `heroku pg:ps` to see the processes then `heroku pg:kill 2048 -a example_app_name` to kill the process. https://help.heroku.com/I6HY032G/how-do-i-fix-a-stuck-postgres-process – rpearce Oct 21 '20 at 11:45