nx10 / httpgd

Asynchronous http server graphics device for R.
https://nx10.github.io/httpgd
GNU General Public License v2.0
382 stars 19 forks source link

Server don't response when used via RServe #144

Open genmeblog opened 9 months ago

genmeblog commented 9 months ago

Describe the bug

This case is probably the same as in https://github.com/nx10/httpgd/issues/142. When httpgd is used via RServe (it's a proxy library which allows calling R functions via socket) web server is hanged after first plot. Only first thumbnail is displayed. Any other successive plots have no effect. Refreshing a browser hangs.

To Reproduce

Install RServe and RSclient packages.

install.packages(c("Rserve","RSclient"))

In first R session:

> library(Rserve)
> run.Rserve(port=56789)
-- running Rserve in this R session (pid=1636), 1 server(s) --
(This session will block until Rserve is shut down)

In the second R session:

> library(RSclient)
> c <- RSconnect(port=56789)
> RSeval(c,"library(httpgd)")
[1] "httpgd"    "Rserve"    "stats"     "graphics"  "grDevices" "utils"
[7] "datasets"  "methods"   "base"
> RSeval(c,"hgd()")
NULL
> RSeval(c,"x<-c(1,2,3,4,5,6); y<-c(4,5,6,7,8,9); plot(x,y)")
NULL
> RSeval(c,"x<-c(1,2,3,4,5,6); y<-c(4,5,6,7,8,9); plot(x,y)")
NULL
> RSeval(c,"hgd_state()")
$host
[1] "127.0.0.1"

$port
[1] 49117

$token
[1] "Rlx7D4Rm"

$hsize
[1] 2

$upid
[1] 70

$active
[1] TRUE

URL after calling hgd() is displayed in the first session.

> library(Rserve)
> run.Rserve(port=56789)
-- running Rserve in this R session (pid=1636), 1 server(s) --
(This session will block until Rserve is shut down)
httpgd server running at:
  http://127.0.0.1:49117/live?token=Rlx7D4Rm

Expected behavior

http server shouldn't hang.

Screenshots

image

Environment