Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank reactlog in browser ? #89

Open
homer3018 opened this issue Jan 12, 2023 · 15 comments
Open

Blank reactlog in browser ? #89

homer3018 opened this issue Jan 12, 2023 · 15 comments

Comments

@homer3018
Copy link

Playback issue

Hello. I seem to have a playback issue where the reactlog shows blank in my browser, while the top bar definitely shows steps. I have no nodes and can't do anything. Tried with Safari and Edge, results is the same. I've tried while the app is running, and after having stopped it, same results.

Screenshot attached:
Screenshot 2023-01-12 at 09 55 01

I have also exported it with dput(shiny::reactlog(), file = "reactlog.txt") :
reactlog.txt

SessionInfo() :

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] fpc_2.2-9                broom_1.0.1              mclust_5.4.10            vroom_1.6.0              patchwork_1.1.1          reactlog_1.1.1          
 [7] DT_0.23                  shinyjqui_0.3.3          shinydashboardPlus_2.0.3 rebus_0.1-3              odbc_1.3.3               DBI_1.1.3               
[13] shinycssloaders_1.0.0    xts_0.12.1               zoo_1.8-10               lubridate_1.8.0          scales_1.2.1             forcats_0.5.1           
[19] stringr_1.4.0            dplyr_1.0.9              purrr_0.3.4              readr_2.1.2              tidyr_1.2.0              tibble_3.1.8            
[25] tidyverse_1.3.1          shinyWidgets_0.7.5       plotly_4.10.0            ggplot2_3.4.0            shinyjs_2.1.0            shinydashboard_0.7.2    
[31] shiny_1.7.1             

loaded via a namespace (and not attached):
 [1] colorspace_2.0-3      ellipsis_0.3.2        class_7.3-20          modeltools_0.2-23     fs_1.5.2              rstudioapi_0.14       farver_2.1.0         
 [8] flexmix_2.3-17        bit64_4.0.5           fansi_1.0.3           xml2_1.3.3            cachem_1.0.6          robustbase_0.95-0     jsonlite_1.8.2       
[15] cluster_2.1.3         kernlab_0.9-31        dbplyr_2.1.1          compiler_4.2.1        httr_1.4.2            backports_1.4.1       assertthat_0.2.1     
[22] fastmap_1.1.0         lazyeval_0.2.2        cli_3.4.1             later_1.3.0           htmltools_0.5.3       tools_4.2.1           gtable_0.3.0         
[29] glue_1.6.2            rebus.base_0.0-3      Rcpp_1.0.9            cellranger_1.1.0      jquerylib_0.1.3       vctrs_0.5.1           crosstalk_1.1.1      
[36] rebus.datetimes_0.0-1 rvest_1.0.1           mime_0.12             lifecycle_1.0.3       rebus.numbers_0.0-1   DEoptimR_1.0-8        MASS_7.3-57          
[43] hms_1.0.0             promises_1.2.0.1      parallel_4.2.1        yaml_2.3.5            sass_0.4.1            stringi_1.7.6         rlang_1.0.6          
[50] pkgconfig_2.0.3       prabclus_2.3-2        lattice_0.20-45       fontawesome_0.4.0     htmlwidgets_1.5.4     labeling_0.4.2        bit_4.0.4            
[57] tidyselect_1.1.2      magrittr_2.0.3        R6_2.5.1              generics_0.1.0        pillar_1.8.1          haven_2.5.0           withr_2.5.0          
[64] nnet_7.3-17           rebus.unicode_0.0-2   modelr_0.1.8          crayon_1.4.1          utf8_1.2.2            tzdb_0.3.0            grid_4.2.1           
[71] readxl_1.4.0          data.table_1.14.2     blob_1.2.3            reprex_2.0.1          digest_0.6.29         diptest_0.76-0        xtable_1.8-4         
[78] httpuv_1.6.5          stats4_4.2.1          munsell_0.5.0         viridisLite_0.4.0     bslib_0.3.1       

Thanks !

@homer3018
Copy link
Author

homer3018 commented Jan 12, 2023

I just tried to upgrade and use shiny_1.7.4 but no luck.

However the search labels bar is working. As I type something I know is there, it's bringing the topper to the appropriate timestamp. I still can't see a thing though...

@schloerke
Copy link
Collaborator

Thank you for the reactlog.txt file! I am able to reprex the display issue.

Opening the chrome debugger, r155 is depending on r3. r155 is defined as:

list(action = "define", reactId = "r155", 
    label = structure("output$cycle_table", srcfile = "server.R")

I can see a successful definition of cycle_data_inter (r128), so it is not that specific reactive value.

Does your output$cycle depend on something that is not in your server definition?

Does your reactlog work if you call shiny::reactlogShow()? (This shows all reactive knowledge, not just a specific reactive session.)

@homer3018
Copy link
Author

homer3018 commented Jan 12, 2023

Thanks for helping out !
So output$cycle is just a plot depending on cycle_data, which in turn depends on cycle_data_ref and cycle_data_inter.

shiny::reactlogShow()launch the browser but with the same display issue.

> shiny::reactlogShow()
warning messages from top-level task callback '1'
Warning message:
In is.call(expr) && as.character(expr[[1]]) %in% c("<-", "=") :
  'length(x) = 3 > 1' in coercion to 'logical(1)'

Everything lies in my server file and the UI is pretty basic, only displaying UIOutput and conditionalPanel etc.

Upon testing a little bit, calling output$cycle (the plot) works fine, and I can see the log up to that point.
output$cycle_table trigger the display issue and as I refresh the page once I've called it, the entire tree is not there anymore.
output$cycle_time_clustering does the same.

@schloerke
Copy link
Collaborator

How and where is cycle_data_ref defined?

@schloerke
Copy link
Collaborator

Can you try calling the code below and let me know the output?

options(warn = 2)
shiny::reactlogShow()
traceback()

@schloerke
Copy link
Collaborator

If it's a ok with you, may I have your app code? 😃😃😃

@homer3018
Copy link
Author

> options(warn = 2)
> shiny::reactlogShow()
> traceback()
11: execCallbacks(timeoutSecs, all, loop$id)
10: run_now(timeoutMs/1000, all = FALSE)
9: service(timeout)
8: serviceApp()
7: ..stacktracefloor..(serviceApp())
6: withCallingHandlers(expr, error = doCaptureStack)
5: domain$wrapSync(expr)
4: promises::with_promise_domain(createStackTracePromiseDomain(), 
       expr)
3: captureStackTraces({
       while (!.globals$stopped) {
           ..stacktracefloor..(serviceApp())
       }
   })
2: ..stacktraceoff..(captureStackTraces({
       while (!.globals$stopped) {
           ..stacktracefloor..(serviceApp())
       }
   }))
1: shiny::runApp("CD00_67_Shiny")

I'd love to share my code but unfortunately I can't do that.

As for cycle_data_ref, it is a relatively easy transformation of cycle_data_inter.
cycle_data is then a join of cycle_data_inter and cycle_data_ref.
Does that answer your question ? (Where is it defined ?)

@schloerke
Copy link
Collaborator

Thank you. Please call options(warn = 0) to reset it


Can you paste the code for the definition of cycle_data_ref? I'm trying to figure out why the {reactlog} is not defining it. {shiny}/{reactlog} knows output$cycle depends on cycle_data_ref, but there is no definition for it. I'm curious how cycle_data_ref can be created while not being defined.

Where in your code is cycle_data_ref written? Within your server function? Outside of your server function?


Debugging for the warning...

The logs above didn't give anything, it is just the {promise} package (which {shiny} uses for the runtime loop).

I found this issue: r-lib/testthat#1620 which is fixed in r-dbi/odbc#494 . Installing r-dbi/odbc from GitHub should make the warning go away until the next release of {odbc}.

... maybe it'll make {reactlog} work? 🤷‍♂️

@homer3018
Copy link
Author

Yes cycle_data_ref is defined within the server function, nothing really fancy in there :

    cycle_data_ref <- reactive({        
        data <- cycle_data_inter() %>%
            filter(!GANTRY) %>% 
            group_by(STATION_GROUP) %>%
            count(REF) %>%
            filter(!is.na(REF), REF != "") %>%
            mutate(ORDER = rank(-n)) %>% 
            arrange(STATION_GROUP, ORDER)
        
        if (nrow(data) > 0) {
            data <- data %>%
                mutate(TOP_REF = paste0("#", ORDER, " OP", STATION_GROUP, " - ", REF))
        }
        
        return(data)
    })

@schloerke
Copy link
Collaborator

(After install r-dbi/odbc from GitHub, be sure to restart your R session)


Thank you for the code! You're correct. Nothing there that shouldn't make it work.


For fun, can you try adding label = "cycle_data_ref" to the reactive() function call?

Ex:

    cycle_data_ref <- reactive(label = "cycle_data_ref", {
        data <- cycle_data_inter() %>%
            filter(!GANTRY) %>% 
            group_by(STATION_GROUP) %>%
            count(REF) %>%
            filter(!is.na(REF), REF != "") %>%
            mutate(ORDER = rank(-n)) %>% 
            arrange(STATION_GROUP, ORDER)
        
        if (nrow(data) > 0) {
            data <- data %>%
                mutate(TOP_REF = paste0("#", ORDER, " OP", STATION_GROUP, " - ", REF))
        }
        
        return(data)
    })

@homer3018
Copy link
Author

The install from GitHub is failing 😞 :

   ** testing if installed package can be loaded from temporary location
   Error: package or namespace load failed for ‘odbc’ in dyn.load(file, DLLpath = DLLpath, ...):
    unable to load shared object '/private/var/folders/lj/mbj_rxz12wvdp8kfmcpj14f00000gq/T/Rtmpentrfn/Rinst1d364288a867/00LOCK-odbc/00new/odbc/libs/odbc.so':
     dlopen(/private/var/folders/lj/mbj_rxz12wvdp8kfmcpj14f00000gq/T/Rtmpentrfn/Rinst1d364288a867/00LOCK-odbc/00new/odbc/libs/odbc.so, 0x0006): Library not loaded: @rpath/libodbc.2.dylib
     Referenced from: <BC5426D7-1EBE-34E4-A40F-3B8B6E0E2856> /private/var/folders/lj/mbj_rxz12wvdp8kfmcpj14f00000gq/T/Rtmpentrfn/Rinst1d364288a867/00LOCK-odbc/00new/odbc/libs/odbc.so
     Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@rpath/libodbc.2.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libodbc.2.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-17.0.1+12/Contents/Home/lib/server/libodbc.2.dylib' (no such file)
   Error: loading failed
   Execution halted
   ERROR: loading failed
─  removing ‘/private/var/folders/lj/mbj_rxz12wvdp8kfmcpj14f00000gq/T/Rtmpentrfn/Rinst1d364288a867/odbc’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'odbc' from GitHub:

The label label = "cycle_data_ref" does not change anything.

@schloerke
Copy link
Collaborator

Worth a try to install {odbc} from GitHub. Thank you.

Don't know if the macOS instructions here would help: https://github.com/r-dbi/odbc#macos . Don't know if libodbc is installed via unixodbc.


Unfortunately without an minimal Shiny app to test on my side, it makes debugging very hard.

I'll leave the issue open, but I don't think we'll find the original reason why 😭

@homer3018
Copy link
Author

I'll have a closer look at odbc and unixodbc (I do think libodbc comes with it but I'd have to double check on this one...).
I'm not fully convinced at this stage that this would change anything, but worth trying I agree.


I know and I'm sorry, I simply can't share this. It might be partly my fault in the sense that I used to use quite regularly the reactlog and at some point stopped. Now a whole lot of commits have been pushed, and all I want is a clear flowchart of all the relationships and for some reason it's not working. It might have been easier to look into that as soon as I'd have noticed this...
I'll keep investigating and report should I find something worth mentioning.

Thanks for your help so far. Very much appreciated :)

@homer3018
Copy link
Author

Hey, since cycle_table breaks the display, would it help if I just export the reactlog calling just this one ? It is rather a "simple" one as it only depends on cycle_data_inter.
The reactlog.txt you have was when I called every single outputs in my app to have the full blown flowchart.

@schloerke
Copy link
Collaborator

I'm not fully convinced at this stage that this would change anything, but worth trying I agree.

I agree. It will probably only get rid of the warning.


If you can share any Shiny app that has the unexpected behavior, that'd be great! (...But that is easier said than done.)

I'd like to know how the reactlog is being recorded improperly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants