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

segmentation fault when unlisting in-place list column #4166

Closed
fklirono opened this issue Jan 9, 2020 · 3 comments · Fixed by #4350
Closed

segmentation fault when unlisting in-place list column #4166

fklirono opened this issue Jan 9, 2020 · 3 comments · Fixed by #4350
Labels
non-atomic column e.g. list columns, S4 vector columns segfault
Milestone

Comments

@fklirono
Copy link

fklirono commented Jan 9, 2020

reproducible example:

dt<-data.table(a=list(1:2, 1:3))
dt[, a:=unlist(a)]
dt

data.table version: 1.12.8

session info:

R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

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   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] data.table_1.12.8 colorout_1.2-0    rmarkdown_2.0    

loaded via a namespace (and not attached):
[1] compiler_3.6.2  tools_3.6.2     htmltools_0.4.0 Rcpp_1.0.3      knitr_1.26      xfun_0.11       digest_0.6.23   rlang_0.4.2     evaluate_0.14  
@jangorecki
Copy link
Member

thank you for reporting, I can reproduce on recent devel

@MichaelChirico
Copy link
Member

Hmm it doesn't segfault for me, but the table is clearly broken (or at least, did the wrong thing):

dput(dt)
# structure(list(a = list(c(1L, 2L, 1L, 2L, 3L), c(1L, 2L, 1L, 2L, 3L))), row.names = c(NA, -2L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x7f936e0044e0>)

@D3SL
Copy link

D3SL commented Apr 20, 2020

I think I ran into the same issue. I found a workaround using the unnest_dt2 function from here. For anyone else looking to do the same be sure not to use unnest_dt, it mangles numbers so coercing back to integer/numeric results in a column full of NAs.

Reproducible example:

library(data.table)
testdata<-data.frame(start=seq(30001,80001,10000),end=seq(40000,90000,10000))
testdata<-as.data.table(testdata)
testdata[,range:=list(list(start:end)),by=1:nrow(testdata)]
testdata[,range:=unlist(range)]

sessioninfo:
data.table version: 1.12.8

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] reprex_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1      ps_1.3.0        digest_0.6.20   R6_2.4.1        evaluate_0.14   rlang_0.4.5    
 [7] fs_1.3.1        callr_3.4.3     whisker_0.4     rmarkdown_2.1   tools_3.6.3     xfun_0.13      
[13] compiler_3.6.3  processx_3.4.0  clipr_0.7.0     htmltools_0.3.6 knitr_1.28   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non-atomic column e.g. list columns, S4 vector columns segfault
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants