-
Notifications
You must be signed in to change notification settings - Fork 384
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
Race condition fix #1032
Race condition fix #1032
Conversation
fine with this, since this isn't a hot path (in a production run) we'd like to avoid exception raising. @deivid-rodriguez you might want to target 50-stable if you'd like this in next 50.x 51.x 52.x releases |
@kares I don't have any objection in the sense this probably is not super common and will only pay a penalty in those particular circumstances. Otherwise we will need to lock access and I feel like that will be a higher per use penalty. I guess if this is really common then perhaps we do something else? Is it though? |
pbly not - the reported use-case is pretty much artificial ... its a test-case run |
@kares yeah then we won't sweat it until we see -Xlog.exceptions and notice it is happening too much :) |
Yeah, if I understood the error correctly, this is happening when creating the |
Sure, yeah. Activeadmin currently supports all of those, so ideally we would want the change backported to all stable branches. I just wanted to start with master to agree on what the best fix is for this, then I can open backports 👍. |
Actually, this is the connection method so I guess this happens once every time we connect to the DB? What I don't understand is that in our specs this folder should've already been created by the time the exception happened. So, I don't understand how this happened. |
4a27286
to
1b54c53
Compare
I got this error again and dug in a bit more but I'm still very confused. The backtrace is now slightly different since now it shows an absolute path in the error message:
From reading the surrounding code, it sounds like But since RSpec first loads all tests files before trying to run them and I'm requiring |
I never experienced this again, and I don't like this "solution" anyways, so closing! |
While testing activeadmin, our parallel test suite run into the following error:
As I understand it, this is a race condition where two threads would check
File.directory?(dirname)
and both get a negative answer because the directory does not yet exist, and then both try to create the directory, causing the last thread to crash.This PR attempts to fix the error by rescuing the potential exception caused by the race condition.