REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.05k stars 122 forks source link

Suddenly httpgd plots stopped working #1447

Open memeplex opened 7 months ago

memeplex commented 7 months ago

This is not the first time I have the issue. Sometimes httpgd just stops working and no plot panel is shown after a plot command. Even if I restart VSCode the error persists. I don't know how to fix it. It may be related to my previous report (https://github.com/REditorSupport/vscode-R/issues/1445) to solve which I had to recreate my workspace from scratch.

The output pane I see errors like these:

2023-11-13 10:22:41.418 [error] FetchError: request to http://127.0.0.1:50505/plot?id=0&renderer=svgp&width=800&height=600&zoom=1 failed, reason: socket hang up
    at ClientRequest.<anonymous> (/Users/carlos/.vscode/extensions/reditorsupport.r-2.8.2/dist/extension.js:2:1878046)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketOnEnd (node:_http_client:526:9)
    at Socket.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-11-13 10:22:41.546 [error] Error: ENOENT: no such file or directory, open '/var/folders/sz/t88v7mcx541gn9wn9cjsv1600000gn/T/RtmpAVrQQg/vscode-R/workspace.lock'
2023-11-13 10:22:41.810 [error] FetchError: request to http://127.0.0.1:50518/plot?id=0&renderer=svgp&width=800&height=600&zoom=1 failed, reason: socket hang up
    at ClientRequest.<anonymous> (/Users/carlos/.vscode/extensions/reditorsupport.r-2.8.2/dist/extension.js:2:1878046)
    at ClientRequest.emit (node:events:513:28)

To Reproduce

This is just too random to give you a recipe. Hope the trace above helps.

Can you fix this issue by yourself? (We appreciate the help)

No.

uhkeller commented 7 months ago

For me it also doesn't work if I run radian in a terminal (on macOS), so it looks like it's not a problem with the R extension or VS code. It works fine in a normal R session running in a terminal, but if I start a httpgd device in radian and plot something, the server seems to hang after generating the thumbnail of the first plot. The plot itself is never displayed and subsequent plot commands seem to do nothing. When I try to end the R session it hangs at "Server closing…".

uhkeller commented 7 months ago

It looks like you're on macOS was well. Are you by any chance using Python version 3.11.6_1? I think on my machine the problem started after updating Python to this version.

memeplex commented 7 months ago

I'm on macOS, that's true. You are right about it being related to radian, a vanilla R REPL doesn't show the same issue. Python is 3.11.5. I don't know how to track the events you describe above, sometimes there is no error in the Extension Host pane at all. I reinstalled the extension, I created a new R lib folder with just languageserver and httpgd, I created a new project, all to no avail. The only thing that made a difference was to switch from radian to vanilla REPL. Maybe it was a recent radian, and not python, update?

memeplex commented 7 months ago

Seems related to https://github.com/REditorSupport/vscode-R/issues/973.

uhkeller commented 7 months ago

The version of radian I'm using was installed on October 19th, I'm almost 100% sure it worked for some time after that. Maybe some dependency of radian that was updated later?

To me it's clear that this is a radian/httpgd problem, not a VS Code/R extension problem. I've just tried installing the current dev version of httpgd from GitHub which didn't help. I'll make an issue for radian.

memeplex commented 7 months ago

I've downgraded radian to 0.6.7 and it's the same. The session is attached but no plot is shown.

memeplex commented 7 months ago

To me it's clear that this is a radian/httpgd problem, not a VS Code/R extension problem.

I'm not that sure. I can open the http server from radian and plot there as decribed in https://nx10.github.io/httpgd/articles/a01_how-to-get-started.html. It seems specific to the communication with the extension viewer.

uhkeller commented 7 months ago

I can open the http server from radian and plot there

Hmm, I can't. radian issue is here.

memeplex commented 7 months ago

You're right, it's just the thumbnail that is shown, it's not actually working.

benz0li commented 7 months ago

radian v0.6.9 is out which resolves this issue.