Discourse: PG::InternalError (ERROR: subplan "SubPlan 2" was not initialized CONTEXT: parallel worker )

Looks like we will need to rebuild our (single) data container soon to get rid of this error in Discourse. Or, I will just build Discourse for scratch and restore the data and switch over when it is done to minimize down time.

PG::InternalError (ERROR:  subplan "SubPlan 2" was not initialized
CONTEXT:  parallel worker
)
app/models/private_message_topic_tracking_state.rb:29:in `report'
app/controllers/users_controller.rb:323:in `private_message_topic_tracking_state'
app/controllers/application_controller.rb:399:in `block in with_resolved_locale'
app/controllers/application_controller.rb:399:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:187:in `call'

This error appears when using PMs / DMs (direct messages) in my account; but no one else has reported it.

Rebuilding this data container as Jay did in that topic will cause the site to be off line for maybe 30 minutes.

afael dos Santos SilvaFalcoteam

28d

That is indeed a PostgreSQL bug that was solved in latest minor version. Can you do a rebuild? That will update the PostgreSQL to latest minor.

Ok I saw this at the time but as Jay said it was one user, I thought we were not affected... :confused:

Guess I will rebuild the data container this weekend…

community# docker exec -it pg13  bash -c 'psql --version'
psql (PostgreSQL) 13.1 (Debian 13.1-1.pgdg100+1)

Rebuilding our data container did not work as per the meta instructions (above); but I managed to improvise and 30 minutes later, it's running again and all is good.

community# docker exec -it pg13  bash -c 'psql --version'
psql (PostgreSQL) 13.4 (Debian 13.4-4.pgdg100+1)

As I understand meta from the past, they consider multi-containers solutions "not supported" so it is not a surprise that the instructions above did not work for us. I knew going into the data container rebuild that it would not go smoothly per the meta-talk on this bug.

The good news, is that bug is quashed, I assume, with the PG upgrade and new data container.

See Also:

https://www.postgresql.org/docs/release/13.4/

Note:

After this upgrade, although not required, performed:

VACUUM ANALYZE:
REINDEX SCHEMA CONCURRENTLY public;

.... just because I was already working on the DB and seems like a good housekeeping thing to do.

The site does seem a little faster after housekeeping; but that could all be in my imagination. I notice our cars and motorcycles always seem to run better after we wash them :slight_smile: