xcherryio / xcherry

server and main repo of xCherry project
Apache License 2.0
26 stars 1 forks source link

Fix deadlock in ProcessIdReusePolicy integration tests #51

Closed longquanzheng closed 1 year ago

longquanzheng commented 1 year ago
dev-postgres-1  | 2023-10-18 14:53:56.152 UTC [14344] ERROR:  deadlock detected
dev-postgres-1  | 2023-10-18 14:53:56.152 UTC [14344] DETAIL:  Process 14344 waits for ShareLock on transaction 4426; blocked by process 14722.
dev-postgres-1  |   Process 14722 waits for ShareLock on transaction 4425; blocked by process 14344.
dev-postgres-1  |   Process 14344: SELECT
dev-postgres-1  |       id as process_execution_id, is_current, status, history_event_id_sequence, state_execution_sequence_maps, wait_to_complete
dev-postgres-1  |       FROM xdb_sys_process_executions WHERE id=$1 FOR UPDATE
dev-postgres-1  |   Process 14722: UPDATE xdb_sys_async_state_executions SET
dev-postgres-1  |   version = CASE WHEN wait_until_status=1 OR execute_status=1 THEN version+1 ELSE version END,
dev-postgres-1  |   wait_until_status = CASE WHEN wait_until_status=1 THEN 5 ELSE wait_until_status END,
dev-postgres-1  |   execute_status = CASE WHEN execute_status=1 THEN 5 ELSE execute_status END
dev-postgres-1  |   WHERE process_execution_id=$1
dev-postgres-1  |
dev-postgres-1  | 2023-10-18 14:53:56.152 UTC [14344] HINT:  See server log for query details.
dev-postgres-1  | 2023-10-18 14:53:56.152 UTC [14344] CONTEXT:  while locking tuple (19,39) in relation "xdb_sys_process_executions"
dev-postgres-1  | 2023-10-18 14:53:56.152 UTC [14344] STATEMENT:  SELECT
dev-postgres-1  |       id as process_execution_id, is_current, status, history_event_id_sequence, state_execution_sequence_maps, wait_to_complete
dev-postgres-1  |       FROM xdb_sys_process_executions WHERE id=$1 FOR UPDATE