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

segfault error with mutate (with code to reproduce) #1329

Closed
jlegewie opened this Issue Aug 18, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@jlegewie
Contributor

jlegewie commented Aug 18, 2015

I have a lot of segfault errors ever since version 0.4.1. They are always hard to pin down so I just downgraded to 0.4.0 for a while. Now I am able to reproduce one consistently using the development version of dplyr on my computer (Mac OS X 10.5.5). Here is what I do: start R, copy & paste the code in the console, get segfault error. I am getting similar errors with other code it's just hard to reproduce them. This one happens consistently. The code works without the mutate at the end of the pipe or when I change the mutate arguments.

code with segfault error

# load libraries
library("rvest")
library("magrittr")
library("tidyr")
library("dplyr")
library("readr")
sessionInfo()
# get data
odmp <- rvest::html("http://www.odmp.org/search/year/1998") %>%
    # extract data from webpage
    html_node("#secondary-layout-two-column-one-body") %>%
    html_nodes("table") %>%
    extract2(1) %>%
    html_table(fill = TRUE) %>%
    magrittr::extract(1:178,) %>%
    setNames(c("logo", "cell", "empty")) %>%
    separate(cell, c("name", "agency", "date", "cause"), "\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t") %>%
    mutate(logo = NULL)

error message

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

Traceback:
 1: .Call("dplyr_mutate_impl", PACKAGE = "dplyr", df, dots)
 2: mutate_impl(.data, dots)
 3: mutate_.tbl_df(tbl_df(.data), .dots = dots)
 4: mutate_(tbl_df(.data), .dots = dots)
 5: as.data.frame(mutate_(tbl_df(.data), .dots = dots))
 6: mutate_.data.frame(.data, .dots = lazyeval::lazy_dots(...))
 7: mutate_(.data, .dots = lazyeval::lazy_dots(...))
 8: mutate(., logo = NULL)
 9: function_list[[k]](value)
10: withVisible(function_list[[k]](value))
11: freduce(value, `_function_list`)
12: `_fseq`(`_lhs`)
13: eval(expr, envir, enclos)
14: eval(quote(`_fseq`(`_lhs`)), env, env)
15: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
16: odmp %>% html_node("#secondary-layout-two-column-one-body") %>%     html_nodes("table") %>% extract2(1) %>% html_table(fill = TRUE) %>%     magrittr::extract(1:178, ) %>% setNames(c("logo", "cell",     "empty")) %>% separate(cell, c("name", "agency", "date",     "cause"), "\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t") %>% mutate(logo = NULL)

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

sessionInfo()

R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

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] readr_0.1.1      dplyr_0.4.2.9002 tidyr_0.2.0      magrittr_1.5     rvest_0.1.0      Defaults_1.1-1  

loaded via a namespace (and not attached):
[1] assertthat_0.1 DBI_0.3.1      httr_1.0.0     parallel_3.1.3 R6_2.0         Rcpp_0.12.0    stringi_0.4-1  stringr_1.0.0  tools_3.1.3   

@romainfrancois romainfrancois self-assigned this Aug 19, 2015

@romainfrancois romainfrancois added this to the 0.5 milestone Aug 19, 2015

@romainfrancois

This comment has been minimized.

Member

romainfrancois commented Aug 19, 2015

Thanks. The example can be reduced to this :

> d <- data.frame( x = 1:10, y = 1:10 )
> d %>% mutate( x = NULL )

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

Traceback:
 1: .Call("dplyr_mutate_impl", PACKAGE = "dplyr", df, dots)
 2: mutate_impl(.data, dots)
 3: mutate_.tbl_df(tbl_df(.data), .dots = dots)
 4: mutate_(tbl_df(.data), .dots = dots)
 5: as.data.frame(mutate_(tbl_df(.data), .dots = dots))
 6: mutate_.data.frame(.data, .dots = lazyeval::lazy_dots(...))
 7: mutate_(.data, .dots = lazyeval::lazy_dots(...))
 8: mutate(., x = NULL)
 9: function_list[[k]](value)
10: withVisible(function_list[[k]](value))
11: freduce(value, `_function_list`)
12: `_fseq`(`_lhs`)
13: eval(expr, envir, enclos)
14: eval(quote(`_fseq`(`_lhs`)), env, env)
15: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
16: d %>% mutate(x = NULL)

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: 2
Save workspace image? [y/n/c]: n

On it.

@jlegewie

This comment has been minimized.

Contributor

jlegewie commented Aug 19, 2015

Great. Thanks. Works for me. I tried d <- data.frame( x = 1:10, y = NA ); d %>% mutate( y = NULL ) as a more concise and didn't realize that it's the first column...

@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.