-
Notifications
You must be signed in to change notification settings - Fork 997
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
data.table randomly crashes R when using set
on a DT with attributes
#6410
Comments
I can reproduce it in a vanilla R session with data.table 1.15.4:
sessionInfo:
When using
|
@hongyuanjia As an immediate fix, you can use |
@hongyuanjia Thanks for the temp solution. |
Did some digging. The crash is happening in this line: Line 563 in 6c69c15
And it only happens when the |
Probably related to what is warned in |
Lines 135 to 136 in be97437
...but it is too late for the TRUELENGTH checks on
Lines 507 to 516 in be97437
I suppose that a |
On my side, there are cases in which R did not crash, and I am pretty sure I saw the error message from Line 515. |
It is a heisenbug on my windows system: test() does not always crash R, but eventually it will if you run it many times.
|
I get an error on the first try on windows, using R version 4.4.1 (2024-06-14 ucrt) -- "Race for Your Life"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> setwd('c:/Users/hoct2726/R')
> test <- function() {
+ mtcars <- data.table::setDT(data.table::copy(mtcars))
+ attr(mtcars, "bullet") <- "some test"
+ data.table::set(mtcars, NULL, "test", NA_character_)
+ }
> test()
Error in data.table::set(mtcars, NULL, "test", NA_character_) :
It appears that at some ealier point, attributes of this data.table have been reassigned. Please ensure to use setattr() rather than attr<-. Otherwise, please report to data.table issue tracker.
> sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
time zone: America/Toronto
tzcode source: internal
attached base packages:
[1] stats graphics utils datasets grDevices methods base
loaded via a namespace (and not attached):
[1] compiler_4.4.1 tools_4.4.1 data.table_1.16.99
> |
Minimal reproducible example
I found that
set()
crashes R when an attribute is present in a DT. The code below may reproduce the error, but it should be run multiple times. I have no idea why.Output of sessionInfo()
The text was updated successfully, but these errors were encountered: