Cannot expire connection, it is owned by a different thread
cannot start a transaction within a transaction
SQLite3::BusyException: database is locked
I’ve tried a lot of different workarounds, but to no avail. I tried running test suite in postgresql and mysql, but with much the same results. Any tips or hints would be very much appreciated!
I’m familiar with Postgres but wondering whether SQLite has a mechanism to log query text when a query is canceled (blocked) due to failing to acquire a lock? If so you might be able to identify the source query or query holding a lock.
This is curious, because it’s possible in PostgreSQL anyway. There are warnings but not errors.
@localhost:5432 # BEGIN;
BEGIN
@localhost:5432 # BEGIN;
WARNING: there is already a transaction in progress
BEGIN
@localhost:5432 # COMMIT;
COMMIT
@localhost:5432 # COMMIT;
WARNING: there is no transaction in progress
COMMIT
For Cannot expire connection I’d have to search the source code.
What version of PostgreSQL did you try? And I assume it’s a “stock” configuration with things like the transaction isolation level left in their default values?
psql (16.1) on macos
running this minitest suite hangs and/or produces errors like:
WARNING: there is already a transaction in progress
Emessage type 0x49 arrived from server while idle
message type 0x5a arrived from server while idle
.....................................................................................F.........................................................................................................................message type 0x49 arrived from server while idle
message type 0x5a arrived from server while idle
message type 0x49 arrived from server while idle
I’m facing the same issue. @avonderluft have you managed to figure this out yet? I’m trying to find which tests cause this to lock exactly. I am using minitest too.
@avonderluft Im facing the same issue. I discovered that when I run the tests pointing to a single file the error does not occur. but if I run the tests pointing to an entire folder the error appears
Yes @Bala_Paranj1 for some reason when i remove Spring that doesn’t happen again. I also tried with adding self.use_transactional_tests = false to the test helper and also worked.
I’ve the same problem with Rails 7.1.3.4 and the superb default Minitest.
I have solved adding this line in config/environments/test.rb:
# Use the test adapter for Active Job.
# When enqueuing jobs with the Inline adapter the job will be executed immediately.
config.active_job.queue_adapter = :inline
I think the default adapter :async has problems with rails 7.1 and testing.