[R] corrupted double-linked list

Göran Broström goran.brostrom at umu.se
Thu Jan 29 13:49:37 CET 2015


On 2015-01-29 12:42, Duncan Murdoch wrote:
> On 29/01/2015 6:24 AM, Göran Broström wrote:
>> Hello,
>>
>> A weird thing happened to me while I was playing around in the R console
>> with a data frame ('fert'). The finale was
>>
>> -----------------------------------------------------
>>   > with(fert[fert$parity == 4, ], table(age, event))
>>            event
>> age         0   1   2
>>     (14,20]   0   0   0
>>     (20,25]   6  43  41
>>     (25,30]  57 565 513
>>     (30,35] 121 719 686
>>     (35,40] 165 309 317
>>     (40,45] 156  45  29
>>     (45,50]  13   0   0
>>   > fit1 <- coxph(Surv(exit - enter, event > 0.5) ~ strata(age) + civst +
>> birthdate, data = fert[fert$parity == 0, ])
>> *** Error in `/usr/local/lib/R/bin/exec/R': corrupted double-linked
>> list: 0x0000000004f1aa40 ***
>> Aborted
>> ------------------------------------------------------
>> There was no .Rhistory file left (and my memory is too short) so I
>> cannot reproduce it, but what is a "double-linked list"?
>
> That message likely comes from the C runtime library glibc, not directly
> from R.  It says that the memory being managed by C has been corrupted,
> presumably by an out of bounds write sometime earlier.  (This might
> conceivably happen if an object had been cleaned up by the R memory
> manager then referred to later, but that usually gives a different error.)
>
> If you can make it reproducible we could track it down, but it's much
> harder without that.  You could try running your code under valgrind if
> you know how to do that (or want to read the manual and learn).

I ran

$ R -d "valgrind --leak-check=full --show-reachable=yes -v" -f koll.R 2> ojd

on koll.R:

load("fert.rda")
library(eha)
fert$age <- cut(fert$enter, c(15, 20, 25, 30, 35, 40, 45, 50))
fert$age <- cut(fert$enter, c(14, 20, 25, 30, 35, 40, 45, 50))

fit <- coxreg(Surv(exit - enter, event > 0.5) ~ strata(age) + civst +
                  birthdate, data = fert[fert$parity == 0, ])
fit1 <- coxph(Surv(exit - enter, event > 0.5) ~ strata(age) + civst +
                  birthdate, data = fert[fert$parity == 0, ])
summary(fit1)

which produced an output of 22765 lines. A quick scan of them showed 
nothing in particular, except:

(lines 50 - 54):
--29802--   .. CRC mismatch (computed 1fb85af8 wanted 2e9e3c16)
--29802--    object doesn't have a symbol table
==29802== WARNING: new redirection conflicts with existing -- ignoring it
--29802--     old: 0x04019ca0 (strlen              ) R-> (0000.0) 
0x38068331 ???
--29802--     new: 0x04019ca0 (strlen              ) R-> (2007.0) 
0x04c2e1a0 strlen

and, at the end:
==29802== LEAK SUMMARY:
==29802==    definitely lost: 0 bytes in 0 blocks
==29802==    indirectly lost: 0 bytes in 0 blocks
==29802==      possibly lost: 0 bytes in 0 blocks
==29802==    still reachable: 39,088,272 bytes in 13,280 blocks
==29802==         suppressed: 0 bytes in 0 blocks
==29802==
==29802== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==29802== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

(should this go to R-devel? I could try harder to provoke the error.)

Göran

> Duncan Murdoch
>
>>
>> This is on Ubuntu 14.10 with  R  built from source.
>>
>>   > sessionInfo()
>> R version 3.1.2 Patched (2014-12-08 r67137)
>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>
>> locale:
>>    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>    [3] LC_TIME=sv_SE.UTF-8        LC_COLLATE=en_US.UTF-8
>>    [5] LC_MONETARY=sv_SE.UTF-8    LC_MESSAGES=en_US.UTF-8
>>    [7] LC_PAPER=sv_SE.UTF-8       LC_NAME=C
>>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] splines   stats     graphics  grDevices utils     datasets  methods
>> [8] base
>>
>> other attached packages:
>> [1] eha_2.4-2       survival_2.37-7
>>
>> loaded via a namespace (and not attached):
>> [1] tools_3.1.2
>>
>> Göran
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>



More information about the R-help mailing list