-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
fix: fix proxy error handling and race conditions #585
Conversation
hey, coverage is required. currently I wanna use |
and i'm not sure, Is this panic caused by race conditions? |
This is a normal flow
If the user opened two tabs accessing the proxy, we would have 2 subscribers, and if suddenly the browser is closed those two subscriptions will be removed from the map, but a map is not thread safe, that's why I am moving from sync.Mutex (which prevents race condition with reads) to |
Regarding the coverage, I will see if I can improve the tests for proxy. But for |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #585 +/- ##
==========================================
+ Coverage 67.34% 68.89% +1.55%
==========================================
Files 12 11 -1
Lines 1078 1061 -17
==========================================
+ Hits 726 731 +5
+ Misses 264 243 -21
+ Partials 88 87 -1 ☔ View full report in Codecov by Sentry. |
UT is fine. because u already covered enough |
I improved the error handling by avoiding log.Fatal as much as possible which doesn't clean up the resources properly (leaving the process and ports open). I couldn't reproduce this issue with the steps mentioned but after running
go test -v -count=1 -race -run TestProxyStream ./runner
a few times I got some race condition warnings. You can run those tests to validate the new behaviour working as expected with no warnings. I also added a CORS wildcard allow asked in another issue.