[datatable-help] Random segfaults

Matthew Dowle mdowle at mdowle.plus.com
Tue Dec 20 15:32:47 CET 2011


Can you provide the output of str(DT) please?  Off list or obfuscated, or
both is fine. And the commands you're running on it also. The row.names
look suspect for example. A saved object, even better. As soon as I have
data (or at least detailed structure) and commands then so far it's been
quite quick to find and fix.

Thanks for running valgrind. I've (now) realised that for these types of
bug valgrind probably isn't going to help. I ran also for the last 2 and
it didn't find them.

Other things that might give clues, are to set all these on before running
the script :

gcinfo(TRUE)
options(datatable.verbose=TRUE)

And finally a wild stab in the dark ... are you 'plonking' with :=?  i.e.
adding or replacing a column by providing a RHS which is as long as the
rows in the table so can be 'plonked' straight in?   Because foo:=foo
would do that, but do you really mean assigning foo to itself ?  Copying a
column to a new name is perhaps something I haven't considered or tested.


> One random error (variable names changed).
>
>> DT[,foo:=foo]Error in `[.data.table`(DT, , `:=`(foo, foo)) :  
>> SET_VECTOR_ELT() can only be applied to a 'list', not a 'NULL'
> where foo was a vector in the global environment that I was trying to
> assign to a column named foo in DT. DT after that error looks like:
>
>> DT
> NULL
> attr(,"row.names")
>   [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16
> 17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34
>  35  36  37
>  [38]  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53
> 54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71
>  72  73  74
>  [75]  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
> 91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
> 109 110 111
> [112] 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
> 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
> 145 146 147 148
> [149] 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
> 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
> 182 183 184 185
> [186] 186 187 188 189 190 191 192 193 194 195 196 197 198
> attr(,"class")
> [1] "data.table" "data.frame"
> attr(,"sorted")
> [1] "x" "y"
>
> And once again it is random. If I go through and remake DT in the
> exact same session, it works fine.
>
> On 20 December 2011 08:45, Chris Neff <caneff at gmail.com> wrote:
>> Emailed too soon. Crashing again.  I'll renable debugging and see what
>> comes up the next time it happens. Still isn't at all consistent as to
>> when exactly it crashes.  I just have a script that makes a data.table
>> that I know will eventually crash if I use the data.table enough.
>> Can't reproduce on toy sets.
>>
>> In regards to the valgrind request, I ran test.data.table with
>> valgrind on and everything passed.  It timed out when trying to run my
>> script though, and was way way slower than normal in the process.
>>
>>
>> On 20 December 2011 07:56, Chris Neff <caneff at gmail.com> wrote:
>>> So far so good. The state before this latest patch was I would run my
>>> script, and then try to mess with the resultant data.table, and almost
>>> immediately it would segfault. 10 minutes of playing and no segfaults
>>> yet.  Will update if there is one.
>>>
>>> On 19 December 2011 20:12, Chris Neff <caneff at gmail.com> wrote:
>>>> I definitely do that somewhere in my code. I'll patch tomorrow and
>>>> try.
>>>>
>>>> On 19 December 2011 19:03, Matthew Dowle <mdowle at mdowle.plus.com>
>>>> wrote:
>>>>> Chris,
>>>>>
>>>>> Are you returning any character or list() columns in j when grouping?
>>>>> If
>>>>> so, Jim Holtman provided a reproducible example and a fix has just
>>>>> been
>>>>> committed. Same errors / seg faults, and, for R >= 2.14.0, not just R
>>>>> <
>>>>> 2.14.0. Could this also be the same problem Timothée Carayol
>>>>> mentioned?
>>>>> Fingers crossed ...
>>>>>
>>>>> Matthew
>>>>>
>>>>>
>>>>> On Sat, 2011-12-17 at 00:27 +0000, Matthew Dowle wrote:
>>>>>> It'd be good to get to the bottom of it in case it's not a
>>>>>> pre-2.14.0
>>>>>> problem.  Try this :
>>>>>>
>>>>>> apt-get install valgrind  (if not already installed)
>>>>>> R -d valgrind
>>>>>> require(data.table)
>>>>>> test.data.table()
>>>>>>
>>>>>> When I do this it runs very slowly but eventually completes ok with
>>>>>> just
>>>>>> test 120 failing. Test 120 is a timing test, which takes longer
>>>>>> because
>>>>>> of valgrind mode, so that's ok. Ignore the valgrind messages for R
>>>>>> itself that happen before R's banner comes up.
>>>>>>
>>>>>> If you get the same, then proceed to run your tests that crash it.
>>>>>> Hopefully you'll get some messages at the point the corruption
>>>>>> occurs.
>>>>>>
>>>>>>
>>>>>> On Fri, 2011-12-16 at 12:37 -0500, Chris Neff wrote:
>>>>>> > >
>>>>>> > > Only other thought ... your special internal build of R ... does
>>>>>> it
>>>>>> > > increase R_len_t on 64bit to allow longer vectors than 2^31, by
>>>>>> any
>>>>>> > > chance?  I've used R_len_t quite a bit in data.table to future
>>>>>> proof for
>>>>>> > > when that happens, but if you've done it already in your build
>>>>>> then that
>>>>>> > > would help to know since it's never been tested afaik when
>>>>>> R_len_t != int
>>>>>> > > on 64bit.  I'm also assuming R_len_t is signed. If your R has
>>>>>> R_len_t as
>>>>>> > > unsigned would need to know.
>>>>>> >
>>>>>> > Answer to this is no, we haven't touched that.
>>>>>> >
>>>>>> > I'm happy to keep helping, but if you'd rather not worry about
>>>>>> that
>>>>>> > stuff, we will be upgrading to 2.14 in the next few months
>>>>>> apparently,
>>>>>> > and I can live with 1.7.1 until then.
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> datatable-help mailing list
>>>>>> datatable-help at lists.r-forge.r-project.org
>>>>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>>>>>
>>>>>
>




More information about the datatable-help mailing list