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

mutate and typo with first/last crash R #569

Closed
iugrina opened this issue Sep 1, 2014 · 8 comments
Closed

mutate and typo with first/last crash R #569

iugrina opened this issue Sep 1, 2014 · 8 comments
Assignees
Labels
Milestone

Comments

@iugrina
Copy link

@iugrina iugrina commented Sep 1, 2014

Simple typo in mutate with first/last can crash R. I could not reproduce it with non dplyr functions like mean/sum/...

Example:

library(dplyr)

set.seed(123)
df <- data.frame(Userid=sample(1:50, 100, replace=TRUE),
         week=sample(1:10, 100, replace=TRUE), 
         views=sample(1:5, 100, replace=TRUE))

# crashes R!
df %>% mutate(fv = first(view))

 *** caught segfault ***
address 0x8, cause 'memory not mapped'

Traceback:
 1: .Call("dplyr_mutate_impl", PACKAGE = "dplyr", df, args, env)
 2: mutate_impl(.data, named_dots(...), environment())
 3: mutate.tbl_df(tbl, ...)
 4: mutate.data.frame(df, fv = first(view))
 5: mutate(df, fv = first(view))
 6: eval(expr, envir, enclos)
 7: eval(e, env)
 8: withVisible(eval(e, env))
 9: df %>% mutate(fv = first(view))

sessionInfo() output:

R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] 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=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] dplyr_0.2          vimcom.plus_0.9-92 setwidth_1.0-3     colorout_1.0-2    

loaded via a namespace (and not attached):
[1] assertthat_0.1 parallel_3.1.1 Rcpp_0.11.2    tools_3.1.1   
@hadley
Copy link
Member

@hadley hadley commented Sep 1, 2014

This seems to be fixed in the dev version.

Loading

@hadley hadley closed this Sep 1, 2014
@iugrina
Copy link
Author

@iugrina iugrina commented Sep 1, 2014

I have the same problem with the dev version (devtools::install_github) on Debian testing.

sessionInfo():

R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] 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=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] dplyr_0.2.0.99     vimcom.plus_0.9-92 setwidth_1.0-3     colorout_1.0-2    

loaded via a namespace (and not attached):
[1] assertthat_0.1 magrittr_1.0.1 parallel_3.1.1 Rcpp_0.11.2    tools_3.1.1  

Loading

@hadley
Copy link
Member

@hadley hadley commented Sep 1, 2014

Hmmmm, when did you install it?

Loading

@iugrina
Copy link
Author

@iugrina iugrina commented Sep 1, 2014

40 minutes ago
ref: 8c8f2aa

last one (8a68b4c) gives an error when building

** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : undefined exports: rename_vars_q
Error: loading failed
Execution halted

Loading

@hadley hadley reopened this Sep 1, 2014
@hadley hadley added the bug label Sep 11, 2014
@hadley hadley added this to the 0.3 milestone Sep 11, 2014
@hadley
Copy link
Member

@hadley hadley commented Sep 12, 2014

@wch any chance you have a linux box you could try and repo this on?

Loading

@wch
Copy link
Member

@wch wch commented Sep 12, 2014

I can reproduce it:

> library(dplyr)
> devtools::session_info()
Session info-------------------------------------------------------------------
 setting  value                       
 version  R version 3.1.1 (2014-07-10)
 system   x86_64, linux-gnu           
 ui       X11                         
 language en_US                       
 collate  en_US.UTF-8                 
 tz       <NA>                        

Packages-----------------------------------------------------------------------
 package    * version    date       source                            
 assertthat   0.1.0.99   2014-04-10 Github (hadley/assertthat@4a36c23)
 DBI          0.3.0      2014-09-03 CRAN (R 3.1.1)                    
 devtools     1.5.0.9000 2014-09-04 Github (hadley/devtools@98e140c)  
 digest       0.6.4      2013-12-03 CRAN (R 3.1.0)                    
 dplyr      * 0.2.0.99   2014-09-12 Github (hadley/dplyr@f46d3a4)     
 evaluate     0.5.5      2014-04-29 CRAN (R 3.1.0)                    
 httr         0.5        2014-09-02 CRAN (R 3.1.1)                    
 magrittr     1.0.1      2014-05-15 CRAN (R 3.1.0)                    
 memoise      0.2.1      2014-04-22 CRAN (R 3.1.0)                    
 Rcpp         0.11.2     2014-06-08 CRAN (R 3.1.1)                    
 RCurl        1.95.4.3   2014-07-29 CRAN (R 3.1.1)                    
 rstudioapi   0.1        2014-03-27 CRAN (R 3.1.0)                    
 stringr      0.6.2      2012-12-06 CRAN (R 3.1.0)                    
 whisker      0.3.2      2013-04-28 CRAN (R 3.1.0)                    

> set.seed(123)
> df <- data.frame(Userid=sample(1:50, 100, replace=TRUE),
+          week=sample(1:10, 100, replace=TRUE), 
+          views=sample(1:5, 100, replace=TRUE))
> 
> # crashes R!
> df %>% mutate(fv = first(view))

 *** caught segfault ***
address 0x8, cause 'memory not mapped'

Traceback:
 1: .Call("dplyr_mutate_impl", PACKAGE = "dplyr", df, args, env)
 2: mutate_impl(.data, named_dots(...), environment())
 3: mutate.tbl_df(tbl, ...)
 4: mutate.data.frame(df, fv = first(view))
 5: mutate(df, fv = first(view))
 6: eval(expr, envir, enclos)
 7: eval(e, env)
 8: withVisible(eval(e, env))
 9: df %>% mutate(fv = first(view))

Loading

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Sep 16, 2014

I get this:

> df %>% mutate(fv = first(view))
Error in x[[n]] : object of type 'closure' is not subsettable

because view is a function in dplyr.

Loading

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Sep 16, 2014

I can otherwise reproduce it:

> df %>% mutate(fv = first(vie))

 *** caught segfault ***
address 0x8, cause 'memory not mapped'

Traceback:
 1: .Call("dplyr_mutate_impl", PACKAGE = "dplyr", df, args, env)
 2: mutate_impl(.data, named_dots(...), environment())
 3: mutate.tbl_df(tbl, ...)
 4: mutate.data.frame(df, fv = first(vie))
 5: mutate(df, fv = first(vie))
 6: eval(expr, envir, enclos)
 7: eval(e, env, env)
 8: withVisible(eval(e, env, env))
 9: df %>% mutate(fv = first(vie))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

Loading

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants