pg_dump fails to exit during backup and hangs website


(Keith Newton) #1

I’m running Ubuntu 13.10 with pg_dump 9.3.4 and while according to the resulting .sql file pg_dump executes correctly however the process never ends thus hanging the web server. Thus there are 2 problems:

  1. The process isn’t exiting for some reason even though the dump.sql contains the following text:

    – Completed on 2014-04-19 18:32:40 MST


    – PostgreSQL database dump complete

  2. Discourse doesn’t set a time limit on the pg_dump process running therefore if it hangs Discourse itself hangs with the website stuck in a read-only state


(Michael Brown) #2

Can you describe specifically how you are taking the backup?


(Keith Newton) #3

I click the “Backup” button under Admin > Backup.


(Régis Hanol) #4

Hmmm… the backup is done is a forked child process and therefore does not block any of the web processes. There might be something else blocking your web processes.

Would you mind telling us more about your setup? Are you using Docker?


(Keith Newton) #5

“hanging” was probably the wrong choice of word. By “hanging” I meant the website gets stuck in a read-only state with the sidekiq processes suspended. The site itself isn’t hung - just the sidekiq part. I’m not using Docker.


(Régis Hanol) #6

I’ll add a timeout but I’m afraid it won’t solve your issue. Have you tried running the same pg_dump command as in the export?


(Jeff Atwood) #7

I believe @zogstrip added a timeout that handles this case now, yes?


(Michael - DiscourseHosting.com) #8

We’ve seen the same thing a number of times in the last few weeks: sidekiq crashing or stuck, and every time it seemed to be caused by someone taking a backup.


(Sam Saffron) #9

Sidekiq stuck is not really possible these days cause we have a heartbeat job that will restart it.

Stuck in backup state was possible but is fixed in latest.


(Sam Saffron) #10

Is this still an issue? we fixed the buggy areas around this.


(Keith Newton) #11

Hey @sam sorry for taking so long to respond, I am updating my Discourse for the first time in, well, a long time :stuck_out_tongue:. I can confirm that this issue still exists with 1.2.0.beta4. I don’t see where in the code you are handling a situation where pg_dump hangs? There’s also no timeout value in the backup settings or anywhere else that I can find.

pg_dump consistently hangs on pg_dump: setting owner and privileges for INDEX user_id_topic_id_topic_views


(Jeff Atwood) #12

I cannot recall any other reports of this, could it be something specific to your OS or Postgres versions?

And you are on the Docker install, yes?


(Keith Newton) #13

It could be, I’m running the latest ubuntu desktop however the postgres I believe is 9.3. When I manually execute pg_dump with the cmdline you guys generate it still hangs however on my production server it does not. I am not using docker, sticking with the old way since I’m afraid I’ll break something if I try and switch ;). Also I have forked your codebase to add Windows Azure support for uploads/backups and I don’t know how well your docker images would work with that. I suspect I’d have to create my own?


(Keith Newton) #14

Also when I execute backup through my production server pg_dump fails due to a character in the DB user info that makes the generated command line invalid. You can fix it by putting the user info in quotes.