posit-dev / positron

Positron, a next-generation data science IDE
https://positron.posit.co
Other
2.82k stars 90 forks source link

Console locks up when viewing previous plot #5020

Open grasshoppermouse opened 1 month ago

grasshoppermouse commented 1 month ago

System details:

Positron and OS details:

Positron Version: 2024.10.0 (Universal) build 14 Code - OSS Version: 1.93.0 Commit: 901ab5d11d694212d32e53b97f771c5d601e428e Date: 2024-10-09T15:26:55.363Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Darwin arm64 23.6.0

Interpreter details:

R 4.4.0

Describe the issue:

Clicking on a previous plot locks up the console.

Steps to reproduce the issue:

library(qgraph)
data(big5)
data(big5groups)

# First plot
qgraph(cor(big5),minimum=0.25,groups=big5groups, legend=TRUE,borders=FALSE, title = "Big 5 correlations")

# Second identical plot
qgraph(cor(big5),minimum=0.25,groups=big5groups, legend=TRUE,borders=FALSE, title = "Big 5 correlations")

After clicking on the first plot (perhaps resizing it) the console locks up for a long time (e.g., unable to run R functions like ls())

Expected or desired behavior:

Able to view previous plots without the console locking up

Were there any error messages in the UI, Output panel, or Developer Tools console?

Error popup:

Error rendering plot to 'Auto' size: RPC timed out after 30 seconds: {"jsonrpc":"2.0","method":"render","params":{"size":{"height":695,"width":919},"pixel_ratio":2,"format":"png"}} (-32603)

Another error:

Error rendering plot to 'Auto' size: RPC timed out after 30 seconds: {"jsonrpc":"2.0","method":"get_intrinsic_size"} (-32603)

jmcphers commented 1 month ago

I can reproduce this:

Image

jmcphers commented 1 month ago

This doesn't reproduce outside qgraph as far as I can tell, likely an interaction between how that package draws graphics and how we manage the graphics device. I didn't see any errors in the R kernel logs, but did notice hundreds of these messages where we switch back and forth between gd_mode 1/0:

[R]   2024-10-15T16:11:06.713576Z  INFO  [graphics] gd_mode: 1
[R]     at crates/ark/src/plots/graphics_device.rs:499
[R] 
[R]   2024-10-15T16:11:06.713605Z  INFO  [graphics] gd_mode: 0
[R]     at crates/ark/src/plots/graphics_device.rs:499
[R] 
[R]   2024-10-15T16:11:06.713792Z  INFO  [graphics] gd_mode: 1
[R]     at crates/ark/src/plots/graphics_device.rs:499
[R] 
...