Ran into a issue on our PostgreSQL 10.1 cluster that seems to be a parallel index scan bug. Our queue system scheduled 30 almost identical concurrent queries where some of them was executed as parallel queries and all of them became stuck on IPC BtreePage lock.
Hi Tim,
Thanks for the report. This seems to be the same as the bug that we just analysed over here:
Checked for similar bug reports and related git commits when it happened Thursday last week but didn’t occur to me to double check today before submitting. Looks like You have all the necessary information from the other report.
We discovered this after they've been stuck like that for about 10 hours [1]. At the same time a autovacuum was progressing one of the queried tables and it had become stuck in LWLock buffer_content while vacuuming indexes. None of the query processes responded to pg_cancel_backend nor pg_terminate_backend including the autovacuum.
Hmm. This may be because we hold a BT_READ lock while waiting in _bt_parallel_seize(). Here it's extended by the above-mentioned bug, preventing others from acquiring an exclusive lock.