# Rake:rebake קורס עם שגיאות: PG::ConnectionBad: PQsocket

**URL:** <https://meta.discourse.org/t/rake-rebake-crashes-with-errors-pg-pqsocket/256344>\
**Category:** Self-hosting\
**Tags:** server-resources\
**Created:** [27 בפברואר,‏ 2023,‏ 6:03am UTC](https://meta.discourse.org/t/rake-rebake-crashes-with-errors-pg-pqsocket/256344 "2023-02-27T06:03:26Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)\
**Post date:** [27 בפברואר,‏ 2023,‏ 6:03am UTC](https://meta.discourse.org/t/rake-rebake-crashes-with-errors-pg-pqsocket/256344/1 "2023-02-27T06:03:26Z")

</div>

I migrated a 200,000-post forum to a new server. The live site was put in read-only mode so there wouldn’t be downtime.

I restored the backup on a different subdomain so that users wouldn’t see the install screens or any problems that might happen during the restore – something like `dev.example.com`.

As soon as the restore was complete, I pointed the DNS as the new server and changed the `app.yml` file’s domain to the normal `forum.example.com`.

Then all the smilies in the based posts were pointing at the `dev.example.com` server, so I ran `rake:rebake`.

It gets through about 1,000-2,000 posts before crashing with errors about the database connection.

Here are a couple of excerpts:

```plaintext
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.4/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
     1999 / 200968 ( 1.0%)
Failed to rebake (topic_id: 78730, post_id: 210607)
PG::ConnectionBad: PQsocket() can't get socket descriptor

```

```plaintext
/var/www/discourse/lib/tasks/posts.rake:108:in `rebake_posts_all_sites'
/var/www/discourse/lib/tasks/posts.rake:7:in `block in <main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

Caused by:
PG::ConnectionBad: PQsocket() can't get socket descriptor

```

At the moment, I have the images loading by redirecting the `dev.example.com` domain to the `forum.example.com` domain, but it’s just a temporary solution.

Does anyone know how to get past that error so I can rebake all the posts? Is it creating too much load on the database?

---

_[View the full topic](https://meta.discourse.org/t/rake-rebake-crashes-with-errors-pg-pqsocket/256344)._
