-
Notifications
You must be signed in to change notification settings - Fork 504
[o11y] Do error checking in R2 earlier #5756
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
Conversation
|
@mar-cf: Re. tests: This is already being tested in |
CodSpeed Performance ReportMerging #5756 will not alter performanceComparing Summary
Footnotes
|
|
Discussed privately and while this might improve things in local dev and so there's no reason not to run it - it won't actually sort out the prod errors because of some added layers in the prod environment between the user worker and R2's worker. |
I can see it fire off the base here, but on main it no longer fires for me.
Let's upgrade the error to a test assertion. Given I can't see the effect in main and Dan's concerns about the additional prod layers posing a problem, I'm hesitant to believe this does anything. I'm not opposed to anything in here, so I'll stamp anyway if you feel like it's worth to have this. I think addressing Dan's concern is time better spent. |
I'm not sure if there was any concern being raised per se – he just noted that this would not silence the warning in prod since R2 is implemented differently there. As you said this no longer silences any warnings in workerd, but it still allows us to avoid some superfluous memory allocations since in the error case we no longer have to construct a HttpClient and associated structures, plus a WorkerInterface/WorkerTracer within workerd – the impact is smaller than anticipated, which I will note in the updated commit description. It's still good practice to only do expensive operations after conducting error checking. |
Before #5790, this would have avoided "destructed WorkerTracer" warnings when we would construct a WorkerInterface but not end up using it due to the errors being detected later. However, this 1) does not apply for prod where R2 is implemented differently and 2) no longer fixes a warning since the WorkerInterface never has delivered() called. However, it is still good practice to check for errors earlier and avoid memory allocations from the getHttpClient() calls. While this PR is not aiming for completion I also cleaned up a call in web-socket.c++ that may be susceptible to the same issue.
346bcd3 to
923ab9f
Compare
With #5685, we managed to reduce the volume of "destructed WorkerTracer" warnings by >80% by eliminating it in the case of duplicate alarm events. Another case where this happens are R2 API calls where we create a new WorkerInterface for the R2 call before completing error checking, as seen in the r2-test itself. We can easily avoid this by moving getHttpClient() calls behind error checks.
While this PR is not aiming for completion I also cleaned up a call in web-socket.c++ that may be susceptible to the same issue.