[Vm-dev] Re: [Pharo-project] GZipWriteStream crashing my VM when serializing ?

David T. Lewis lewis at mail.msen.com
Sat Dec 10 01:16:58 UTC 2011


Hi Mariano,

This looks like a nasty bug in the plugin, but I cannot reproduce it.
I have Fuel loaded in my Squeak image running on Linux, and I ran
FLMethodContextSerializationTest>>testMethodContextThisContext without
a crash. I tried it on both Cog and a standard VM, and did not get
a crash in either case. The test fails (probably for some Squeak/Pharo issue)
but it gets through the serialize/materialize part of the test without
any problem.

Am I perhaps running a different version of Fuel that does not
exercise the ZipPlugin in the same way?

Dave


On Fri, Dec 09, 2011 at 07:31:56PM +0100, Mariano Martinez Peck wrote:
>  
> So...after debugging the VM, it looks it is crashing in DeflatePlugin >>
> encodeMatch: length distance: dist
> 
> encodeMatch: length distance: dist
>     "Encode the given match of length length starting at dist bytes ahead"
>     | literal distance |
>     <inline: true>
>     zipLiterals at: zipLiteralCount put: length - DeflateMinMatch.
>     zipDistances at: zipLiteralCount put: dist.
>     literal := (zipMatchLengthCodes at: length - DeflateMinMatch).
>     zipLiteralFreq at: literal put: (zipLiteralFreq at: literal) + 1.
>     dist < 257
>         ifTrue:[distance := zipDistanceCodes at: dist - 1]
>         ifFalse:[distance := zipDistanceCodes at: 256 + (dist - 1 bitShift:
> -7)].
>     zipDistanceFreq at: distance put: (zipDistanceFreq at: distance) + 1.
>     zipLiteralCount := zipLiteralCount + 1.
>     zipMatchCount := zipMatchCount + 1.
>     ^zipLiteralCount = zipLiteralSize "We *must* flush"
>         or:[(zipLiteralCount bitAnd: 16rFFF) = 0 "Only check every N kbytes"
>             and:[self shouldFlush]]
> 
> When it does:     zipDistanceFreq at: distance put: (zipDistanceFreq at:
> distance) + 1.
> it gives a EXC_BAD_ACCESS.
> distance value is 1444965993
> 
> The sender is #deflateBlock: lastIndex chainLength: chainLength goodMatch:
> goodMatch
> and sender #primitiveDeflateBlock
> 
> If I do a call printAllStacks(), I get this part:
> 
> (gdb) call printAllStacks()
> Process 0x1f70c924 priority 40
> 0xbff65968 M GZipWriteStream(DeflateStream)>deflateBlock 555574892: a(n)
> GZipWriteStream
> 0xbff6598c M GZipWriteStream(DeflateStream)>nextPutAll: 555574892: a(n)
> GZipWriteStream
> 0xbff659a8 M GZipWriteStream(DeflateStream)>next:putAll:startingAt:
> 555574892: a(n) GZipWriteStream
> 0xbff659cc M FLBufferedWriteStream>flushBuffer 556072120: a(n)
> FLBufferedWriteStream
> 0xbff659e4 M FLBufferedWriteStream>nextBytesPutAll: 556072120: a(n)
> FLBufferedWriteStream
> 0xbff65a04 M FLBufferedWriteStream>nextStringPut: 556072120: a(n)
> FLBufferedWriteStream
> 0xbff65a24 M [] in FLVariablesMapping>serializeMappingOn: 557179132: a(n)
> FLVariablesMapping
> 0xbff65a44 M OrderedCollection>do: 557179148: a(n) OrderedCollection
> 0xbff65a64 M FLVariablesMapping>serializeMappingOn: 557179132: a(n)
> FLVariablesMapping
> 0xbff65a80 M
> FLFixedObjectCluster(FLPointerObjectCluster)>serializeInstancesStepWith:
> 556081188: a(n) FLFixedObjectCluster
> 0xbff65a9c M FLSerialization>clusterInstancesStepOf: 556076884: a(n)
> FLSerialization
> 0xbff65ab8 M [] in FLSerialization>instancesStep 556076884: a(n)
> FLSerialization
> 
> 
> And from the gdb I get:
> 
> #0    0x000b3721 in deflateBlockchainLengthgoodMatch at ZipPlugin.c:303
> #1    0x000b4a62 in primitiveDeflateBlock at ZipPlugin.c:719
> #2    0x1f400858 in ??
> #3    0x00067820 in threadSchedulingLoop at gcc3x-cointerpmt.c:45853
> #4    0x0003d79b in initialEnterSmalltalkExecutive at
> gcc3x-cointerpmt.c:18372
> #5    0x0003e45f in initStackPagesAndInterpret at gcc3x-cointerpmt.c:18839
> #6    0x00022ae8 in interpret at gcc3x-cointerpmt.c:2076
> #7    0x0006df20 in -[sqSqueakMainApplication runSqueak] at
> sqSqueakMainApplication.m:174
> #8    0x92ee186c in __NSFirePerformWithOrder
> #9    0x967fadd2 in __CFRunLoopDoObservers
> #10    0x967b6ced in __CFRunLoopRun
> #11    0x967b63c4 in CFRunLoopRunSpecific
> #12    0x967b61f1 in CFRunLoopRunInMode
> #13    0x98262e04 in RunCurrentEventLoopInMode
> #14    0x98262af5 in ReceiveNextEventCommon
> #15    0x98262a3e in BlockUntilNextEventMatchingListInMode
> #16    0x93159595 in _DPSNextEvent
> #17    0x93158dd6 in -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> #18    0x9311b1f3 in -[NSApplication run]
> #19    0x93113289 in NSApplicationMain
> #20    0x0006bec9 in main at main.m:52
> 
> 
> Any pointer is appreaciated.
> 
> THanks
> 
> 
> 
> On Fri, Dec 2, 2011 at 11:57 PM, Diogenes Moreira <
> diogenes.moreira at gmail.com> wrote:
> 
> > en que SO estas corriendo..primitiva ??
> > por otro lado que tenes en el PharoDebug.Log
> >
> > http://about.me/diogenes.moreira
> >
> >
> >
> > 2011/12/2 Mariano Martinez Peck <marianopeck at gmail.com>:
> > > Hi guys. We are doing some experiments with Fuel and GZip streams... Now
> > I
> > > have a beatiful test like this:
> > >
> > > testMethodContextThisContext
> > >
> > >     | materializedContext context |
> > >     context := thisContext copy.
> > >     materializedContext := self resultOfSerializeAndMaterialize: context.
> > >
> > > and it crashes like crazy. From the VM crash stack, I can see:
> > >
> > >
> > > Smalltalk stack dump:
> > > 0xbff66ba4 M GZipWriteStream(DeflateStream)>deflateBlock 447551436: a(n)
> > > GZipWriteStream
> > > 0xbff66bc8 M GZipWriteStream(DeflateStream)>nextPutAll: 447551436: a(n)
> > > GZipWriteStream
> > > 0xbff66be4 M GZipWriteStream(DeflateStream)>next:putAll:startingAt:
> > > 447551436: a(n) GZipWriteStream
> > > 0xbff66c08 M FLBufferedWriteStream>flushBuffer 448048664: a(n)
> > > FLBufferedWriteStream
> > > 0xbff66c20 M FLBufferedWriteStream>nextBytesPutAll: 448048664: a(n)
> > > FLBufferedWriteStream
> > > 0xbff66c40 M FLBufferedWriteStream>nextStringPut: 448048664: a(n)
> > > FLBufferedWriteStream
> > > 0xbff66c5c M FLByteStringCluster>serialize:on: 448054196: a(n)
> > > FLByteStringCluster
> > > 0xbff66c7c M
> > FLByteStringCluster(FLPrimitiveCluster)>serializeInstance:with:
> > > 448054196: a(n) FLByteStringCluster
> > > 0xbff66ca0 M [] in
> > > FLByteStringCluster(FLIteratingCluster)>serializeInstances: 448054196:
> > a(n)
> > > FLByteStringCluster
> > > 0xbff66cc8 M IdentitySet(Set)>do: 451711680: a(n) IdentitySet
> > > 0xbff66ce4 M FLByteStringCluster(FLIteratingCluster)>serializeInstances:
> > > 448054196: a(n) FLByteStringCluster
> > > 0xbff66d00 M
> > > FLByteStringCluster(FLIteratingCluster)>serializeInstancesStepWith:
> > > 448054196: a(n) FLByteStringCluster
> > > 0xbff66d1c M FLSerialization>clusterInstancesStepOf: 448053428: a(n)
> > > FLSerialization
> > > 0xbff66d38 M [] in FLSerialization>instancesStep 448053428: a(n)
> > > FLSerialization
> > > 0xbff66d58 M OrderedCollection>do: 449989736: a(n) OrderedCollection
> > > 0xbff66d74 M FLSerialization>instancesStep 448053428: a(n)
> > FLSerialization
> > > 0xbff66d8c M FLSerialization>run 448053428: a(n) FLSerialization
> > > 0xbff66db0 I [] in FLSerializer>defaultSerialization 447550464: a(n)
> > > FLSerializer
> > > 0xbff66dd8 M [] in FLSerializer>serialize:on: 447550464: a(n)
> > FLSerializer
> > > 0xbff66df8 M BlockClosure>ensure: 448052884: a(n) BlockClosure
> > > 0xbff66e18 M FLSerializer>serialize:on: 447550464: a(n) FLSerializer
> > > 0xbff66e3c M [] in
> > > FLMethodContextSerializationTest(FLSerializationTest)>serialize:
> > 447235380:
> > > a(n) FLMethodContextSerializationTest
> > > 0xbff66e60 M [] in GZipWriteStream class(PositionableStream class)>on:do:
> > > 419845144: a(n) GZipWriteStream class
> > > 0xbff66e80 M BlockClosure>ensure: 448048616: a(n) BlockClosure
> > > 0xbff66ea0 M GZipWriteStream class(PositionableStream class)>on:do:
> > > 419845144: a(n) GZipWriteStream class
> > > 0xbff66ec4 M [] in FLGZipStrategy>writeStreamDo: 447550896: a(n)
> > > FLGZipStrategy
> > > 0xbff66ee0 M FLByteArrayStreamStrategy>writeStreamDo: 447550884: a(n)
> > > FLByteArrayStreamStrategy
> > > 0xbff66efc M FLGZipStrategy>writeStreamDo: 447550896: a(n) FLGZipStrategy
> > > 0xbff66f18 M
> > > FLMethodContextSerializationTest(FLSerializationTest)>serialize:
> > 447235380:
> > > a(n) FLMethodContextSerializationTest
> > > 0xbff66f34 M
> > >
> > FLMethodContextSerializationTest(FLSerializationTest)>resultOfSerializeAndMaterialize:
> > > 447235380: a(n) FLMethodContextSerializationTest
> > > 0xbff66f58 M
> > FLMethodContextSerializationTest>testMethodContextThisContext
> > > 447235380: a(n) FLMethodContextSerializationTest
> > >
> > >
> > > any idea of where I should start to look at?
> > >
> > > Thanks
> > >
> > >
> > > --
> > > Mariano
> > > http://marianopeck.wordpress.com
> > >
> >
> 
> 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com



More information about the Vm-dev mailing list