1

I've installed opencpu package in R. I am running the following linein R: library(opencpu) It runs very quickly and says "Welcome to Open CPU!"

Then I run the following line: ocpu_start_server()

It takes about 10 min to say: OpenCPU single-user server, versinon 2.0.3 Starting 2 new worker(s) READYY to server at: ...

I've shut down my R and rerun the commands. Againt - it takes about 10 min. Is this normal? Does it always take so long?

I am on Windows, have a fast connection to the Internet. Thank you!

user3245256
  • 1,842
  • 4
  • 24
  • 51

1 Answers1

0

Update: the problem was not opencpu but rather RGui on Windows not refreshing the console. I have added a tweak to opencpu 2.0.4 to force a console flush after each log line.


No this is not normal, it should run almost immediately. Perhaps your windows firewall or antivirus is blocking the server from opening a port and waiting for you accept? Sure there is no dialog box somewhere in the background?

Can you debug at which step exactly is taking so long? To step through the function use:

debug(ocpu_start_server)
ocpu_start_server()

And then press ENTER repeatedly to step through the function. Please let me know which function call is holding things up.

Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
  • Thank you, Jeroen. No, there was no dialog box in the background. – user3245256 Jul 13 '17 at 20:08
  • Looks like I got stuck here: debug: add_workers() debug: Sys.sleep(0.001) debug: for (i in 1:10) httpuv::service(100) debug: httpuv::service(100) etc. Because it keeps repeating (add_workers()) again and again – user3245256 Jul 13 '17 at 20:22
  • This whole loop is repeated again and again: debug: for (i in 1:10) httpuv::service(100) – user3245256 Jul 13 '17 at 20:23
  • Yes it is supposed to repeat `httpuv::service(100)` while serving :) But what was the point where you got the 10s delay before it started going into the hosting loop? – Jeroen Ooms Jul 14 '17 at 07:53
  • I think I found the "error". There was none. It has to do with how the console window (in R) updates. Before, I just ran the code ocpu_start_server() and waited - without trying to go into the console window. However, the console window does not update - doesn't show anything. Looks like it's hanging. However, if you click on the console window, then you can see the message "ready to server" - and it looks like it's actually happening without any delay. – user3245256 Jul 14 '17 at 13:22
  • Ah right the Windows R GUI updates slowly while R is running. I think this is not a problem in rstudio. – Jeroen Ooms Jul 14 '17 at 13:23
  • I have added a fix to opencpu to flush force a console flush upon printing log lines to the console. – Jeroen Ooms Jul 14 '17 at 13:55