3

I maintain a shiny app > 3000 lines of code. During execution I observe warnings, which might indicate issues I want to follow up for quality management. E.g.

Warning in run(timeoutMs) : 'tzone' attributes are inconsistent

From within the code it is not obvious, where the warning might be created, hence inspecting the code line by line using browser() is not an option (Albeit I tried using options(warn = 1)).

I also tried converting the warnings to errors and then to use debugging techniques via:

options(warn = 2)
options(error = recover)

However, with no success. In this particular case I obtain:

Enter a frame number, or 0 to exit

 1: shiny::runApp("appFolder")
 2: shinyCallingHandlers(while (!.globals$stopped) {
   serviceApp()
   Sys.sleep(0.001)
   })
 3: withCallingHandlers(expr, error = function(e) {
   handle <- getOption("shiny.error")
   if (is.function(handle))
      handle()
   })
 4 : serviceApp()
 5 : service(timeout)
 6 : run(timeoutMs)
 7 : .signalSimpleWarning("'tzone' attributes are incosistent", quote(run(timeoutMs)))
 8 : withRestarts({
    .Internal(.signalcondition(simpleWarning(msg, call), msg, call))
    .Internal(.dfltWarn(msg, call))
    }, muffleWarning = function () NULL)
 9 : withOneRestart(expr, restarts[[1]])
10 : doWithOneRestart(return(expr), restart) 

Selection:

Observing the individual frames did not help me. The answer at R Debugging - Cannot see which line generates warning message (Shiny) did also not help.

Anybody ideas?

Community
  • 1
  • 1
Jens
  • 133
  • 6
  • What's your Sys.timezone()? There's probably an inconsistency between the code's expected (or default time-zone) and your systems – J4y Aug 26 '15 at 09:37
  • @J4y My tz is UTC as the majority of time values I have to deal with. In order to find out where an inconsistency is introduced, it would be really helpful to know the line in the code where the warning is produced. My question is of general nature, the particular warning provided is just an example. – Jens Aug 26 '15 at 10:22
  • 1
    Have you tried `options(warn = 2, shiny.error = recover)`? – Yihui Xie Aug 26 '15 at 14:49
  • 2
    @Yihui Yes I tried `shiny.error = recover` and also `shiny.error = browser` in combination with `warn = 2` within the options. In addition to the output above I get two more frames: `11 : .handleSimmpleError(function (e) {...}` and `12 : h(simpleError(msg, call))`. Both frames again seem not refer to any of my code from which I could deduce where the warning was created, but seem to deal with shiny or R internals. – Jens Aug 27 '15 at 06:33

0 Answers0