-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rails 7.1 hangs in github actions when use_transactional_fixtures = true #2697
Comments
What if you monkey patch the ‘transaction’ method and dump the ‘caller’ on each call (and after ‘super’)? It will be very helpful to understand what is opening the transaction. Where is this message from?
Just in case - i see DatabaseCleaner, but it seems unused. Can you remove it? |
Just to chime in. My specs are hanging with 7.1.1 when being run through the command line, too.
I've spent more than half a day now trying to isolate the issue ... without much success. *Edit: the specs are somewhat randomly hanging. About once in a few runs. I have a feeling that it could be something related to the way transactions are handled in either Rspec or Rails. Also, I'm using |
Hi there, Btw, I've ended up disabling the transactioinal_fixtures and adding databaseCleaner on suite :each. The workaround works fine. And there is no difference on terms of time taken compared with the rspec transaction |
I am encountering a similar issue after upgrading to Rails 7.1.1, although the context is related to job executions happening outside of the transactions wrapping the test. Posting some of my findings here, although I think the issue is related to Rails. class User < ApplicationRecord
after_create_commit do
ExampleJob.perform_later(self)
end
end The reason our test suite hangs on Rails 7.1.1 is because of an When disabling the One solution I found was to set the The other, which can be applied to a specific test or group of test is to set the execution of scheduled jobs to happen immediately (if you are using the I've rolled back to Rails 7.0.8 and found that also there the job would fail with the same frequency, however, here it would not result in the test suite hanging if it did. Since we only updated Rails it appears to be an issue caused by rails. To verify this I re-wrote the specs that fail in minitest, and indeed the hanging behaviour happens there too every 3-4 runs. I'm not sure if this is the same issue that the people above encountered, but for me the issue does not appear to be directly related to rspec. Still I thought it would be worthwhile posting it here for other people that encounter it. |
Thanks for the research, @nbelzer !
Sounds like a bug caused by some race condition.
I would expect them to be executed immediately, too. https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html Would you submit your findings to Rails? |
Sorry for the confusion I meant to write
I've created this repo with instructions on how to replicate using Rails 7.1.1 and minitest (since my issue also happens with minitest, and I wanted to stay close to rails defaults for a reproduction) but so far I've been unable to replicate the tests hanging there.
I'll need to do some more digging to find a way to replicate the hanging issue in the repo linked above. When I do I'll submit the issue to the Rails repo. EDIT: Was not able to replicate the hanging so I ended up posting my findings on a related issue on the rails repo. |
@nbelzer thanks a lot! |
Hi, we are running our test suite with Rspec, recently upgraded to rails 7.1.1 and we find that the github action hangs the processing, it seems that it is waiting for a transaction to complete. Not sure why but we have found that disabling
use_transactional_fixtures
fixes the issue. Not sure if maintainers know something about this?What Ruby, Rails and RSpec versions are you using?
Ruby version: 3.2.2
Rails version: 7.1.1
RSpec version:
rspec-core (3.12.2)
rspec-rails (6.0.3)
Can you provide an example app?
This is the failing job that has the use_transactional_fixtures = true
https://github.com/chaskiq/chaskiq/actions/runs/6499097137/job/17659848634
repo: https://github.com/chaskiq/chaskiq
thanks
The text was updated successfully, but these errors were encountered: