-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Use Foundation.ProcessInfo for environment parsing #573
Use Foundation.ProcessInfo for environment parsing #573
Conversation
My only (slight) concern is that I believe this wasn't thread safe in 5.9 I don't know if it's still the case - or if it matters much at all. Would need to verify that |
Yeah I saw that in the issue - I can verify in 5.9, will draft this guy for now. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #573 +/- ##
==========================================
- Coverage 84.86% 83.68% -1.19%
==========================================
Files 98 99 +1
Lines 5320 4406 -914
==========================================
- Hits 4515 3687 -828
+ Misses 805 719 -86 ☔ View full report in Codecov by Sentry. |
564f624
to
0350eed
Compare
At least as of The underlying access is indeed a char** as @adam-fowler commented in the original issue - I am sorry to say that my low-level cpp knowledge isn't super strong, so this appears thread safe to me, but take that with a grain of salt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you're right. I just looked it up: environ
is not thread safe. Happy to accept this change, but we'll need synchronisation it seems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you're right. I just looked it up: environ
is not thread safe. Happy to accept this change, but we'll need synchronisation it seems.
0350eed
to
a6835e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is replacing like for like and in Swift 6 processInfo.environment is thread safe I'm happy to accept this PR. We can discuss any synchronisation support for 5.x in another PR. Plus we should verify it is an issue.
I retract my approval as we have a failure in the tests
Alright fellas sorry it took me so long to get back to this - as mentioned in #574 there's some thread safety issues here. I think what was happening is that I could not reproduce the failure running As a band-aid I renamed the env var that All of the above said, I am very new to the codebase here and could absolutely be misunderstanding what's happening, so if any of that^ is untrue, please call me on it. TL;DR I don't think this is actually an issue in a real running hummingbird instance since the server is started as a single process and the environment is being properly mutated - just a race in tests. |
- replaces use of `environ` with Foundation
This stops a race condition when running the whole test suite
1ceae90
to
94ae83f
Compare
I think this is fine. The tests should be treated as independent and not affect each other. |
Resolves #571
environ
withFoundation.ProcessInfo