Skip to content

Commit 1e4d8d4

Browse files
committed
test: install the busy handler the test assumes
The unrestorable busy wait test assumed that its connection already had a Ruby busy handler, which PRAGMA busy_timeout reads as 0. Rails 7.2 and later install that handler on each new connection, and an earlier sync call installs it too. A new Rails 7.1 connection instead uses SQLite's own busy_timeout, which PRAGMA reads as 5000. When the test ran first on Rails 7.1, the adapter correctly took the restorable path and put back SQLite's own wait. That wait holds the Ruby VM lock, so the releaser thread could not release the write lock, and the write raised SQLite3::BusyException after 5 s. Seed 11785 failed every time; CI run 35874660739 failed the same way. Install the handler in the test and assert that PRAGMA reads 0, so the test checks the unrestorable path on every Rails version and order.
1 parent c18b82b commit 1e4d8d4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎test/integration/synchronous_invocation_test.rb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,10 @@ def wait(timeout:)
588588
database_adapter = SolidObjects.database_adapter
589589
database_adapter.define_singleton_method(:configured_busy_handler_timeout) { |_connection| nil }
590590

591-
SolidObjects::Record.connection_pool.with_connection do
591+
SolidObjects::Record.connection_pool.with_connection do |connection|
592+
connection.raw_connection.busy_handler_timeout = configured_sqlite_busy_handler_timeout
593+
assert_equal 0, connection.select_value("PRAGMA busy_timeout").to_i
594+
592595
CounterActor.ref("unrestorable").increment
593596

594597
assert_nothing_raised do

0 commit comments

Comments
 (0)