-
Notifications
You must be signed in to change notification settings - Fork 824
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 detecting ENV variables #7478
Comments
@colintucker also replicated this issue by spamming clicks in the site tree within the CMS to inevitably receive "Server Error" in the X-Status |
Can confirm I have encountered this issue in dev. As @zanderwar mentioned I can generate server errors by spamming site tree clicks as well. |
See https://gist.github.com/progmars/1e545d96dd48676a2aa7 Issue is due to putenv acting async. |
A better example laravel/framework#7354 |
It looks as a result of this issue is that we'll need to replace |
https://github.com/vlucas/phpdotenv#usage-notes Should have paid more attention! |
Can we confirm that no other popular framework uses getenv? If that’s not the case then I’d dispute the diagnosis. |
@sminnee I believe laravel canned it for their own methodology. I researched everywhere regarding this issue and recall that being the case somewhere. However there is hard evidence everywhere (and in #ss4 of slack this morning) proving that this is an issue for all operating systems (except OSX so far) - especially Windows. If this is something that gets swept under the rug because other frameworks couldn't be bothered because other popular frameworks couldn't be bothered than I personally (among others) am stuck on lesser versions than 4.0 <3 |
It's not simply the usage of getenv(); If you set your environment vars on your platform (e.g. ssp), it's safe, but loading these in the same request obviously has a race condition. However, we give the impression that |
Should we introduce an |
Or do we recommend that people avoid using .env in prod? |
I've settled for
|
If SetEnv is unreliable something seriously FUBAR is going on. Are you certain about that? Perhaps do a reinstall of apache? |
Sorry, can confirm it's working in .htaccess |
If we use symfony/dotenv instead of vlucas/phpdotenv do we get any better results? |
It looks like Symfony has a wrapper around getenv for the same reason: https://github.com/nicolas-grekas/symfony/blob/f76e420e0959b52e73f1486a7b99771d6553ff01/src/Symfony/Component/DependencyInjection/Container.php#L436 Lesson: |
Hmm - looks like we'll need to define our own we knew that dotenv library wasn't meant for production use but at the same time we do have to accept that some people will use it in prod because of limitations outside of their control. We should aim to get it working as much as we can IMO whilst still saying it shouldn't be used on prod. |
Incoming PR. Important questions first though, I have to do the hardest thing in programming: I thought ::get was a bit... on the nose, leading to Confusion++ since there is alerady c.f. preliminary ideas at: |
Yeah, looks all good to me :) |
PRs:
Replicate:
Inevitable Error:
If you've removed install.php
If you havn't removed it
Affecting: Everyone
The text was updated successfully, but these errors were encountered: