Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord::ConnectionNotEstablished in random places #716

Open
stiig opened this issue Sep 3, 2024 · 0 comments
Open

ActiveRecord::ConnectionNotEstablished in random places #716

stiig opened this issue Sep 3, 2024 · 0 comments

Comments

@stiig
Copy link

stiig commented Sep 3, 2024

Hi team, sometimes we have this error during running the tests

Randomized with seed 38777
..........................F
An error occurred in an `after(:context)` hook.
Failure/Error: DatabaseCleaner.clean_with(:truncation, except: %i[translations])

ActiveRecord::ConnectionNotEstablished:
  connection to server at "127.0.0.1", port 5432 failed: server closed the connection unexpectedly
  	This probably means the server terminated abnormally
  	before or while processing the request.
Randomized with seed 59497
...........*..................................................F
An error occurred in an `after(:context)` hook.
Failure/Error: DatabaseCleaner.clean_with(:truncation, except: %i[translations])

ActiveRecord::ConnectionNotEstablished:
  connection to server at "127.0.0.1", port 5432 failed: FATAL:  the database system is shutting down

we run them in parallel
image
and I have no idea where to find roots of the problem

I tried to set reaping_frequency: 0 setting but it didn't help (logs from runs with this setting)

Versions:

  • database_cleaner-active_record (2.1.0)
  • database_cleaner-core (2.0.1)
  • rails (7.1.3.4)
  • rspec-core (3.13.0)

Tests crash in random places and often a restart helps, we don't have something special for database cleaner, our config:
rails_helper.rb:

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
  end

  config.around do |example|
    DatabaseCleaner.cleaning do
      example.run
    end
  end

  config.after(:all) do
    DatabaseCleaner.clean_with(:truncation, except: %i[translations])
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant