rstudio / webshot2

Take screenshots of web pages from R

Home Page:https://rstudio.github.io/webshot2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors received when using webshot2 (timeout and callback)

charleswidnall opened this issue · comments

I run webshot2 (v 0.1.0) on hundreds of images that I generate and I store the output in my hard disk, a few times per day. Some days it runs fine, but other days it stops with the following message: Error: Chromote: timed out waiting for event Page.loadEventFired.

Thinking that it would be solved by increasing the delay, I changed it from 1 to 2, yesterday. However, today, after running successfully some 300 times, I received a new error message: Error in deregister_callback_fn(): could not find function "deregister_callback_fn". I include both tracebacks below. I cannot reproduce the event that creates the errors (I ran webshot2 10,000 times yesterday and it didn't issue any of the two errors. I include the code below, too.)

If you could provide some guidance on how to set the delay or any other modification you could think about, it would be appreciated.

Tracebacks
The 2nd traceback is exactly the same as the 1st one, except for the change in delay from delay = 1 to delay = 2.

Error: Chromote: timed out waiting for event Page.loadEventFired

12. stop(value)
11. doTryCatch(return(expr), name, parentenv, handler)
10. tryCatchOne(expr, names, parentenv, handlers[[1L]])
 9. tryCatchList(expr, classes, parentenv, handlers)
 8. tryCatch({
        result <- force(expr)
        if (is.promising(result)) {
            value <- NULL ...
 7. force(expr)
 6. domain$wrapSync(expr)
 5. with_promise_domain(domain, {
        tryCatch({
            result <- force(expr)
            if (is.promising(result)) { ...
 4. synchronize(p, loop = private$child_loop)
 3. cm$wait_for(p)
 2. webshot2::webshot(ret_url,
                      paste0("../images/webshot_", tinput,
                             "_600x345.png"), vwidth = 600, vheight = 345, delay = 1) at plotnow1_1_xxx.R#453
 1. create_save_screenshot(tinput)

Error in deregister_callback_fn() :
could not find function "deregister_callback_fn"

12. stop(value)
11. doTryCatch(return(expr), name, parentenv, handler)
10. tryCatchOne(expr, names, parentenv, handlers[[1L]])
9. tryCatchList(expr, classes, parentenv, handlers)
8. tryCatch({
        result <- force(expr)
        if (is.promising(result)) {
            value <- NULL ...
7. force(expr)
6. domain$wrapSync(expr)
5. with_promise_domain(domain, {
        tryCatch({
            result <- force(expr)
            if (is.promising(result)) { ...
4. synchronize(p, loop = private$child_loop)
3. cm$wait_for(p)
2. webshot2::webshot(ret_url,
                     paste0("../images/webshot_", tinput,
                            "_600x345.png"), vwidth = 600, vheight = 345, delay = 2) at plotnow1_1_xxx.R#453
1. create_save_screenshot(tinput)

Test
However, it doesn't reproduce the problem.

library(webshot2)
for(i in 1:10000){
  webshot2::webshot("https://github.com/rstudio/shiny/tree/main/tests",
                    file = "test.png",
                    vwidth = 600, vheight = 345, delay = 0.2)
  print(paste0(i, " - ", Sys.time()))
}