Postgres deadlock when running inspections build

We are using running TeamCity Professional 9.1.5 (build 37377), with Postgres 9.3.11.  When running IntelliJ inspections, we are apparently getting a deadlock, as evidenced by hung postgres queries and what appears to be a deadlock based on running lock analysis queries recommended here: https://wiki.postgresql.org/wiki/Lock_Monitoring.

When I run the "Combination of blocked and blocking activity" query for Postgres version >= 9.2, I see the following results:

 

blocked_pid | blocked_user | blocking_pid | blocking_user | blocked_statement | current_statement_in_blocking_process
-------------+--------------+--------------+---------------+------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------
17046 | root | 17237 | root | update inspection_info set inspection_name=$1, inspection_desc=$2, group_name=$3 where id = $4 | delete from inspection_data where hash=$1
17237 | root | 17223 | root | delete from inspection_data where hash=$1 | update inspection_data set used = 1 where hash in (select distinct R.hash from inspection_results R) and used = 0
30281 | root | 17046 | root | update inspection_info set inspection_name=$1, inspection_desc=$2, group_name=$3 where id = $4 | update inspection_info set inspection_name=$1, inspection_desc=$2, group_name=$3 where id = $4
(3 rows)

The queries remain hung after shutting down TeamCity (consistent with deadlock), and must be manually killed.

 

Please sign in to leave a comment.