bokeh / rbokeh

R interface to Bokeh http://hafen.github.io/rbokeh/
Other
313 stars 66 forks source link

Crash / conflict with other packages? #67

Closed ghost closed 9 years ago

ghost commented 9 years ago

In a new R session I can repeatedly run this:

library(rbokeh)
figure() %>% ly_points(cars$speed, cars$dist)

However when I run this in an environment where I have my packages loaded, rbokeh crashes either immediately or after 1-2 times. "Crash" = hang so badly that I have to xkill R.

What would be the best method to find the problem?

Here is my session info. Also included is the rbokeh startup message for ggplot2.

Thanks!

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                  LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8        LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8           LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8      LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

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

other attached packages:
 [1] XLConnect_0.2-11    XLConnectJars_0.2-9 credit360_0.1       vcd_1.3-2           qcc_2.6             gridExtra_0.9.1     RCurl_1.95-4.5      bitops_1.0-6        jsonlite_0.9.16     DescTools_0.99.10  
[11] manipulate_0.98.932 Hmisc_3.15-0        Formula_1.2-0       survival_2.38-1     mi_0.09-19          arm_1.7-07          lme4_1.1-7          Rcpp_0.11.5         Matrix_1.2-0        MASS_7.3-39        
[21] psych_1.5.1         corrgram_1.7        DMwR_0.4.1          lattice_0.20-31     plyr_1.8.1          knitr_1.9           scales_0.2.4        gdata_2.13.3        stringr_0.6.2       treemap_2.2        
[31] ggplot2_1.0.1       reshape2_1.4.1      lubridate_1.3.3     zoo_1.7-12          data.table_1.9.5   

loaded via a namespace (and not attached):
 [1] splines_3.2.0       foreach_1.4.2       gtools_3.4.1        shiny_0.11.1.9004   TTR_0.22-0          latticeExtra_0.6-26 R2WinBUGS_2.1-19    quantreg_5.11       chron_2.3-45        digest_0.6.8       
[11] RColorBrewer_1.1-2  minqa_1.2.4         colorspace_1.2-6    htmltools_0.2.6     httpuv_1.3.2        SparseM_1.6         xtable_1.7-4        mvtnorm_1.0-2       mgcv_1.8-5          car_2.0-25         
[21] ROCR_1.0-5          nnet_7.3-9          pbkrtest_0.4-2      quantmod_0.4-4      mnormt_1.5-1        proto_0.3-10        mime_0.3            memoise_0.2.1       evaluate_0.5.5      nlme_3.1-120       
[31] gplots_2.16.0       xts_0.9-7           foreign_0.8-63      class_7.3-12        tools_3.2.0         formatR_1.0         gridBase_0.4-7      munsell_0.4.2       cluster_2.0.1       caTools_1.17.1     
[41] nloptr_1.0.4        rstudioapi_0.2      iterators_1.0.7     igraph_0.7.1        labeling_0.3        tcltk_3.2.0         boot_1.3-15         gtable_0.1.2        codetools_0.2-11    abind_1.4-3        
[51] TSP_1.1-0           R6_2.0.1            seriation_1.0-14    KernSmooth_2.23-14  rJava_0.9-6         parallel_3.2.0      rpart_4.1-9         acepack_1.3-3.3     gclus_1.3.1         coda_0.17-1        

> library(rbokeh)

Attaching package: ‘rbokeh’

The following object is masked from ‘package:ggplot2’:

    scale_size
hafen commented 9 years ago

That's not good! I can't think of a reason why this would happen and what it would have to do with rbokeh. I tried unsuccessfully to replicate this on OS X and Ubuntu 12.04 with various packages from your list above. It appears you are using RStudio (I see rstudioapi package)? That might have something to do with it. Could you provide the sequence in which your libraries are loaded?

hafen commented 9 years ago

Also, if you are using RStudio, could you try the same thing from running R in the console?

ghost commented 9 years ago

here is the library loading sequence:

data.table, zoo, lubridate, reshape2, ggplot2, treemap, stringr, gdata, scales, knitr,plyr, 
DMwR, corrgram, psych, mi, Hmisc, DescTools, jsonlite, RCurl, gridExtra, qcc, vcd

Using RStudio 0.99.335.

Very good idea to check from the command line. I just sourced from RStudio and it crashed, then sourced from the command line and from there rbokeh runs without any problem.

hafen commented 9 years ago

Interesting. Now I'm interested to know if this happens with any other htmlwidgets. Also, can you get some kind of log from RStudio? This might be an issue to report to them.

No fun that you can't create rbokeh plots though. I wonder if you could single out a package that when mixed with rbokeh makes things crash.

ghost commented 9 years ago

I just tried library(DT) and the same thing happens.

There is a utility to get crash logs from Rstudio [https://support.rstudio.com/hc/en-us/articles/200488528-RStudio-Backtrace-Utility], but it just creates sessionInfo(). Maybe because I have to xkill it because it hangs completely.

My solution sofar has been to create the data, save them and then start a new session in a separate project. That works fine. I will let the RStudio people know.

hafen commented 9 years ago

Phew - glad it's not specific to rbokeh as I would have no idea what's causing it. Hopefully RStudio can shed some light.

ghost commented 9 years ago

submitted to rstudio:

https://support.rstudio.com/hc/communities/public/questions/203577158-RStudio-crash-with-htmlwidgets

jmcphers commented 9 years ago

Thanks! We'll follow up on the support forum.

jjallaire commented 9 years ago

It looks like the following will also reproduce this:

library(DescTools)
library(dygraphs)
dygraph(ldeaths)

Note that DescTools loads the Tcl/Tk package.

The stack in RStudio at the time of the hang is:

28

This looks like a hang of the TclTk event loop and it also appears to be somewhat timing related. Note that RStudio on Linux isn't generally compatible with TclTk GUI components (due to event loop issues like this one). I'm not sure whether there is anything we can do to resolve this other than to warn away from using TclTk within RStudio.

hafen commented 9 years ago

So to make sure I understand, the issue is that having a completely non-related package loaded that uses Tcl/Tk is the culprit?

jjallaire commented 9 years ago

Yes that's exactly right. That package + any htmlwidget + the right timing will produce the crash. This is not an rbokeh issue at all.

On Thu, May 7, 2015 at 12:24 PM, hafen notifications@github.com wrote:

So to make sure I understand, the issue is that having a completely non-related package loaded that uses Tcl/Tk is the culprit?

— Reply to this email directly or view it on GitHub https://github.com/bokeh/rbokeh/issues/67#issuecomment-99927393.

hafen commented 9 years ago

Closing this as it is not an rbokeh issue. Thanks!