We get frequent random CI failures with errors on feature specs, like the following:
Failures:
1) Search admin searches with an unknown filter
Failure/Error: DatabaseCleaner.clean
ActiveRecord::StatementInvalid:
PG::TRDeadlockDetected: ERROR: deadlock detected
DETAIL: Process 12270 waits for AccessExclusiveLock on relation 16412 of database 16386; blocked by process 12192.
Process 12192 waits for AccessShareLock on relation 16400 of database 16386; blocked by process 12270.
HINT: See server log for query details.
: TRUNCATE TABLE "public"."blog_posts", "public"."series", "public"."countries", "public"."log_entries", "public"."payments", "public"."product_meta_tags", "public"."customers", "public"."products", "public"."orders", "public"."line_items" RESTART IDENTITY CASCADE;
# ./spec/support/database_cleaner.rb:19:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::TRDeadlockDetected:
# ERROR: deadlock detected
# DETAIL: Process 12270 waits for AccessExclusiveLock on relation 16412 of database 16386; blocked by process 12192.
# Process 12192 waits for AccessShareLock on relation 16400 of database 16386; blocked by process 12270.
# HINT: See server log for query details.
# ./spec/support/database_cleaner.rb:19:in `block (2 levels) in <top (required)>'
Finished in 29.41 seconds (files took 3.65 seconds to load)
418 examples, 1 failure
This may or may not be related to DatabaseCleaner
. As an attempt to
fix it, I'm trying this configuration, copied straight from their
documentation at https://github.com/DatabaseCleaner/database_cleaner/blob/v1.7.0/README.markdown