-
Notifications
You must be signed in to change notification settings - Fork 91
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
Help server sometimes throws 502s when requesting help in fresh positron session #3543
Comments
Reported in #5604 by a Windows user Related to #3753, for which we added retries that seem to have reduced the problem Note If you as a user continue to see problems (or see different kinds of problems), what is helpful is to change the R kernel log level to trace and share the logs from the R Console attached as a file to an issue. |
Those kernel logs are really helpful; thank you @HenningLorenzen-ext-bayer! When I do a successful R help call, I see logs about handling the URL like:
I see the same types of logging in @HenningLorenzen-ext-bayer's log. ✅ Then a little later in the logs, I see messages about proxying the various assets:
I do NOT see messages like this in @HenningLorenzen-ext-bayer's logs. 🚫 @HenningLorenzen-ext-bayer can you confirm you don't see any messages like "Proxying URL" for assets including the CSS and HTML and such? Can you also bring up the developer tools console (via "Developer: Toggle Developer Tools") and see what you see there relevant to the Help URLs? I see messages there like:
And no errors related to proxying or these URLs. |
Confirmed.
This is an excerpt from my DevTools console: INFO Creating positron.help client 'positron-help-r-3-471ebf7c'... workbench.desktop.main.js:130831 INFO PositronHelpService language runtime server sent show help event for: http://127.0.0.1:49528/library/stats/html/Chisquare.html workbench.desktop.main.js:62543 [Extension Host] [HPM] Proxy created: / -> http://127.0.0.1:49528 (at Object.info (c:\Users\[Redacted]\AppData\Local\Programs\Positron\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:64217:26)) workbench.desktop.main.js:130821 DEBUG Webview(6f8e14ea-f813-4d8a-94f7-9dcf83f40afa): will update content workbench.desktop.main.js:334971 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing. mountTo @ workbench.desktop.main.js:334971 workbench.desktop.main.js:130821 DEBUG Webview(6f8e14ea-f813-4d8a-94f7-9dcf83f40afa): webview ready Chisquare.html:1 Failed to load resource: the server responded with a status of 502 (Bad Gateway) |
@HenningLorenzen-ext-bayer Maybe we can take a closer look at the proxying, in case something is going wrong there. Could you please try the following:
Here's a video showing these steps: proxy_output.mp4 |
2024-12-11 17:05:35.120 [debug] Starting a help proxy server for target: http://127.0.0.1:51380... 2024-12-11 17:05:35.124 [debug] Started proxy server at http://127.0.0.1:51420 for external URI http://127.0.0.1:51420/. 2024-12-11 17:05:35.127 [debug] Finishing proxy server setup for target http://127.0.0.1:51380 serverOrigin: http://127.0.0.1:51420 externalUri: http://127.0.0.1:51420/ 2024-12-11 17:05:35.672 [trace] onProxyReq - proxy request http://127.0.0.1:51420/library/datasets/html/iris.html -> http://127.0.0.1:51380/library/datasets/html/iris.html method: GET protocol: http: host: 127.0.0.1 url: /library/datasets/html/iris.html headers: {"accept-language":"en-US","accept-encoding":"gzip, deflate, br","sec-fetch-dest":"iframe","sec-fetch-mode":"navigate","sec-fetch-site":"cross-site","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Positron/1.93.0 Chrome/124.0.6367.243 Electron/30.4.0 Safari/537.36","upgrade-insecure-requests":"1","connection":"close","host":"127.0.0.1:51380"} external uri: http://127.0.0.1:51420/ 2024-12-11 17:05:41.249 [trace] onProxyRes - proxy response http://127.0.0.1:51380/library/datasets/html/iris.html -> http://127.0.0.1:51420/library/datasets/html/iris.html status: 502 statusMessage: Bad Gateway headers: {"content-length":"0","connection":"close","date":"Wed, 11 Dec 2024 16:05:41 GMT"} external uri: http://127.0.0.1:51420/ 2024-12-11 17:05:41.249 [trace] onProxyRes - skipping response processing for http://127.0.0.1:51420/library/datasets/html/iris.html |
Thank you Henning! Between the Positron Proxy output and the kernel log, I think the issue is occurring in Ark. We're receiving a 502 Bad Gateway from Ark, which seems to be returned here. I don't think we're returning Bad Gateway due to an Error, since I'm not seeing "Error proxying" in Henning's logs. I'd be curious what response status code we're getting here which is not 200 OK. Maybe we can adding some logging in this area for visibility. From Henning's kernel logs, it looks like Ark tried to setup the "reqwest client" with 3 retries, but then failed and returned the 502 Bad Gateway? Hard to say if we need more retries or if the client is somehow not being configured properly. @juliasilge would someone more familiar with Ark be able to take a look at this code? |
I put up posit-dev/ark#654 to add some more logging in there. |
This bug is frustratingly hard to reproduce and seems to affect windows users.
Sometimes (although not every time) when Positron has been recently started up and a help issue is requested, seemingly from R exclusively, the help pane simply doesn't show anything. When looking at the developer logs there are 502 bad gateway errors for the requested help documentation.
This can be fixed by restarting the R interpreter from the dropdown menu. Another method of fixing is to switch to python and request something from help there, then go back to R.
I can't reproduce this on a mac.
The text was updated successfully, but these errors were encountered: