« first day (1467 days earlier)      last day (3474 days later) » 

10:00 PM
my brain is going numb trying to debug this GC bug... thanks to the crap code that's in the GC function
 
You've already worked on that particular function, you remember?
 
I know
hence why my brain hurts
 
But first step should usually be creating the simplest reproduce script possible. I can't really believe you'll find out what's wrong there with just a bit inspecting here and there…
At least not with such complex recursive functions…
And maybe the bug isn't in that function at all, but somewhere else… and consequences you only see there…
 
Yeah, quite common for bugs to manifest during GC
 
@bwoebi problem is, GC runs hundreds of times through the course of the script without issue, until I hit this one particular spot
I just added some debug info to mark_grey, namely saving the pz of the object we're working on until the exact moment of the tail call. That way I can at least see which object or array has the corrupt hash table
 
10:09 PM
maybe because refcount of something only dropped to zero in that particular gc run…
 
no, it's an invalid pointer
 
ah
 
so pz = *(zval**)p->pData; results in a nonsense pointer (0x28d3e185a to be exact)
then Z_TYPE_P(pz) throws a segfault
so it seems like an internal object is returning a non-zval value in the get_gc handler
at least that's my gut instinct
 
probably. Now you need to find where that invalid pointer is passed…
 
well, depends on the object
I know it was around SplObjectStorage
but it may not be that specific object
ah, it's an array
 
10:13 PM
(yay for triple zval indirection...)
 
this is weird
this is really weird
(gdb) print *orig_pz.value->ht
$13 = {nTableSize = 512, nTableMask = 511, nNumOfElements = 468, nNextFreeElement = 468, pInternalPointer = 0x1dc8450,
  pListHead = 0x1dc8450, pListTail = 0x154b758, arBuckets = 0x1542be0, pDestructor = 0x0, persistent = 0 '\000',
  nApplyCount = 0 '\000', bApplyProtection = 1 '\001', inconsistent = 0}
(gdb) print *orig_pz.value->ht.pListHead
$9 = {h = 0, nKeyLength = 0, pData = 0x1dc8468, pDataPtr = 0x7fffee4d4a40, pListNext = 0x1dc84f0, pListLast = 0x0,
  pNext = 0x0, pLast = 0x0, arKey = 0x0}
so no key
(gdb) print *orig_pz.value->ht.pListHead->pListNext
$10 = {h = 1, nKeyLength = 0, pData = 0x1dc8508, pDataPtr = 0x1248e98, pListNext = 0x1dc8590, pListLast = 0x1dc8450,
  pNext = 0x0, pLast = 0x0, arKey = 0x0}
 
well, the key is (int) 0?
 
for both of them?
 
well, for the latter it's (int) 1?
 
oh, it's simply h for numeric indexes?
 
10:17 PM
(If I'm not wrong h field should be the index key?)
yes
(but don't ask me why the index key field is named "h")
 
hash
 
then call the field hash, not h :-(
 
but we need to optimize for typing
because that's the most important thing
 
I like abbreviations, but not single letter ones…
@ircmaxell well, then we should first strip off the Hungarian notation prefixes from the other fields…
 
so it's a SplObjectStorage instance that's causing the problem, but with 234 members on it. And I have no idea where I construct such a thing...
well, I know where, in my graph implementations, but I have so many graphs, that wtf
sorry, no
An SplObjectStorage, which has 234 members, each of which are another SplObjectStorage instance
which is still likely in the graph, but :-D
 
10:39 PM
I think I may have something
 
hmmm?
 
$38 = {nTableSize = 512, nTableMask = 511, nNumOfElements = 234, nNextFreeElement = 0, pInternalPointer = 0x19d3d78,
  pListHead = 0x19d3d78, pListTail = 0x2857570, arBuckets = 0x2b16ce8, pDestructor = 0x690e2b <spl_object_storage_dtor>,
  persistent = 0 '\000', nApplyCount = 0 '\000', bApplyProtection = 1 '\001', inconsistent = 0}
that's the internal hash table that ZendObjectStorage uses
print *$38.pListHead
$48 = {h = 1783912560785647119, nKeyLength = 16, pData = 0x11140d8, pDataPtr = 0x0, pListNext = 0x2914598, pListLast = 0x0,
pNext = 0x0, pLast = 0x0, arKey = 0x19d3dc0 "V\035"}
ah, nevermind, hash collision
 
I always wondered why isn't nTableMask computed rather than stored? Is it performance?
 
@Sherif no idea. Maybe a micro-optimization…
 
Yeah, sometimes recomputing stuff is faster than storing it.
Just have to measure.
 
10:45 PM
I'm sure the compiler optimizes for it somehow.
 
@LeviMorrison Well, I doubt that (ht->nTableSize - 1) is faster than ht->nTableMask …
 
@Sherif developer ease
 
@bwoebi It all comes down to how that effects memory locality and other things.
 
You never know. Sometimes I'm surprised look at the assembler from gcc :)
 
the nTableMask also avoids branching on empty HTs - dunno if that's important
 
10:46 PM
Yes, definitely doing the -1 could be faster, potentially much faster though unlikely.
 
gcc even turns stuff like % 4 into & 3 and does loop unfolding... compilers be crazy yo
 
@NikiC on empty hts you don't need the nTableMask at all!?
 
@bwoebi empty (as in uninitialized empty) HTs use 0 mask
and a dummy bucket
So you can do arData[h & mask] even if it's empty
 
@NikiC that makes sense
 
But in any case, you'd just have to measure it
 
10:49 PM
But we lose a whole 8 bytes man :/
sad face
 
My assumption is that, given the fast that it's there, it likely is there for a purpose ;)
 
[:sadface:]
 
4 bytes ;)
 
It's an int?
I thought it was long long
 
why would it be?
 
10:50 PM
Because we can haz quadrillion elements :D
 
well, I recently learned that there are server setups with memory in excess of 5 TB. so I guess yeah, we totally need long long table mask ^^
 
Hey, I have access to servers with 100s of GB ;)
I might just be crazy
 
But do you have servers with 5 TB memory? :P
 
God no. It's cheaper to buy 5 TB SSDs at that point.
 
crap...
I don't know what's going on...
 
10:56 PM
@NikiC Some HPC sites do, and it's very useful for exposing bugs in software.
(similarly to what you are mentioning here)
 
I am going home. And grabbing a beer
 
@AndreaFaulds Yeah, Zeev is being retarded.
 
I'm just going to ignore the thread
Sometimes I just don't want to argue
 
To clarify, he's made some good points but that this is "altering the language" is dumb.
I still think examples (maybe a table?) would help show the differences between to_int and the equivalent filter command; "how are these different" has been brought up several times.
Even though I will probably be voting against the RFC, I want the RFC itself to be as good as possible.
^^
 
@Sherif You're not the only one here :P
 
11:08 PM
He's got a good point with the lossless_ prefix though, I too would wonder what the difference between (int) $var and to_int($var) is.
 
@AndreaFaulds I think too it should be a 50%+1 RFC (though I'd probably also reject the RFC as it's now…).
 
Hell, I don't know if there's a difference between intval($var) and (int) $var
 
There's no difference between intval and (int)
 
one's a function, the other is a construct
 
... I meant the result only. :)
 
11:11 PM
@ircmaxell but for the same input we'll always get the same output?
 
should
this farking segfault is killing me
 
aren't there any watchpoints you can set?
 
I don't know where to begin... I know the GC run that triggers it, and I know where it's triggered: github.com/sdboyer/gliph/blob/master/src/Gliph/Graph/…
 
@ircmaxell I mean, you could maybe watch and look when that memory location is set to the invalid pointer?
 
possibly, but there's a shit ton of moving parts going on... right now, I'm trying to figure out which hash table it's in (if it's from teh result of get_gc(), or something else)
 
11:19 PM
because you probably want to know when and where the invalid ptr is added to the ht?
 
yeah, that's fair
I just recompiled adding some more debug stuff to mark_grey, so now I'm waiting the 10 minutes for it to run the cycle until the segfault
 
^ even more annoying…
and segfault doesn't occur when you don't run the other benchmarks?
 
yup
it's at the end of the compilation process for all the functions
if I run the one function, it doesn't trigger
I have to do everything
 
Oh....
 
but before the end, during the compile of the very last function (yay)
 
11:23 PM
I don't want to share your luck... But anyway… have a nice evening, here it's bedtime.
 
Good morning Bob.
 
haha, funny...
 
good night
LOL
hardware watchpoint make the program run 100x slower...
so what took 10 minutes before, si going to take screw you long time
I'm out, later
 
Enjoy the beer...
 

« first day (1467 days earlier)      last day (3474 days later) »