[Vm-dev] [Pharo-dev] Random corrupted data when copying from very large byte array

Stuart Cassoff aa72 at bell.net
Wed Jan 24 22:27:31 UTC 2018


Count is 30!

$ uname -mrsv 
OpenBSD 6.2 GENERIC.MP#382 i386

Image
-----
/tmp/p/Squeak5.1-16551-32bit.image
Squeak5.1
latest update: #16551
Current Change Set: Unnamed1
Image format 6521 (32 bit)

Virtual Machine
---------------
/usr/ports/pobj/ostV_pharo_cog_spur-5.1/build-i386/squeak
Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives VMMaker.oscog-eem.2320]
Unix built on Jan 24 2018 14:19:31 Compiler: 4.2.1 Compatible OpenBSD Clang 5.0.1 (tags/RELEASE_501/final)
platform sources revision VM:  $Date$ Date: $Rev$ Plugins: $URL$ $Rev$
CoInterpreter VMMaker.oscog-eem.2320 uuid: e2692e35-5fc8-4623-95d0-b445b3329f75 Jan 24 2018
StackToRegisterMappingCogit VMMaker.oscog-eem.2324 uuid: 904abc56-e5a8-467e-a337-880211e33805 Jan 24 2018


Stu

> ---------- Original Message ----------
> From: Alistair Grant <akgrant0710 at gmail.com>
> Date: January 24, 2018 at 11:34 AM
> 
> 
> Hi Stu,
> 
> On 23 January 2018 at 21:33, Stuart Cassoff <aa72 at bell.net> wrote:
> >
> > Thanks! Yeah, sorry, I couldn't find the original thread.
> > Anyway I don't really know what to do with this so I pasted into a workspace and hit alt-p.
> > After a while I get a debug popup telling me about something not understanding 'halt'.
> > fyi I've not yet written a line of Smalltalk code in my life so maybe I'm biting off more than I can chew.
> > I get the impression I should make a method 'test4' in some number class. *shrug*
> > Anyway, here's part of the SqueakDebug.log that may be useful.
> 
> Jumping in the deep end! :-)
> 
> I assumed that you're familiar with Smalltalk.
> 
> What was originally supplied was the source for a method, but no class
> definition.
> 
> I threw together a class which runs the method five times and shows the results.
> 
> You should be able to:
> 
> 1. file in the attached source. You can open a File List (Tools ->
> File List), select the file and right click "install into new change
> set".
> 2. Find AKGRandomCorruption in the System Browser to check that it loaded OK.
> 3. Open a workspace and DoIt  "AKGRandomCorruption backgroundRun".
> 
> If you want to check that the process is really running, open a
> process browser and look for "Corruption attempt" at priority 20.
> 
> That will open an inspector, and the whole system will slow down.  It
> runs the test in a separate smalltalk process at low priority.
> Eventually a "Halt" window will pop up, which you can Abandon.
> 
> Then look at "count" and "corruptions" in the inspector.  Anything
> greater than 0 is bad. :-)
> 
> When you report back, please let us know:
> 
> 1. Your operating system
> 2. Squeak version - open "About Squeak..." and copy all the text from
> the Image and Virtual Machine sections.
> 
> Thanks for your offer to help!
> Alistair
> 
> 
> > Stu
> >
> >
> > UndefinedObject>>DoIt
> >         Receiver: nil
> >         Arguments and temporary variables:
> >                 species:        ByteArray
> >                 bufferSize:     16384
> >                 buffer:         #[99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 ...etc...
> >                 totalRead:      18202085
> >                 outputStream:   a WriteStream
> >                 answer:         #[99 99 99 99 10 7 7 7 7 7 125 83 67 73 7 7 7 7 7 7 99 99 99 99 99 99 9...etc...
> >                 inputStream:    a ReadStream
> >                 ba:     #[80 75 3 4 10 7 7 7 7 7 125 83 67 73 7 7 7 7 7 7 99 99 99 99 99 99 99 99 9...etc...
> >                 byte1:  80
> >                 i:      21
> >                 readCount:      15845
> >         Receiver's instance variables:
> > nil
> >
> >
> >> ---------- Original Message ----------
> >> From: Alistair Grant <akgrant0710 at gmail.com>
> >> Date: January 23, 2018 at 10:40 AM
> >>
> >>
> >> Hi Stu,
> >>
> >> On 23 January 2018 at 16:15, Stuart Cassoff <aa72 at bell.net> wrote:
> >> >
> >> > I'm curious to test both of these problems on obsd but don't know what to do to make the problem manifest itself, so if anyone could toss me a (preferably non-null) pointer, that'd be great.
> >> >
> >> >
> >> > Thanks,
> >> >
> >> > Stu
> >>
> >> Just run #test4 (several times :-)) as defined in the original post.
> >>
> >>
> >> Cheers,
> >> Alistair
> >> --
> >>
> >> test4
> >> "self test4"
> >> | species bufferSize buffer totalRead outputStream answer inputStream ba byte1 |
> >>             ba := ByteArray new: 18202085.        ba atAllPut: 99.
> >>    1 to: 20 do: [  :i | ba at: i put: (#[80 75 3 4 10 7 7 7 7 7 125 83
> >> 67 73 7 7 7 7 7 7] at: i) ].    inputStream := ba readStream.
> >> bufferSize := 16384.    species := ByteArray.
> >>     buffer := species new: bufferSize.
> >>     totalRead := 0.
> >>     outputStream := nil.
> >>     [ inputStream atEnd ] whileFalse: [ | readCount |
> >>         readCount := inputStream readInto: buffer startingAt: 1 count:
> >> bufferSize.
> >>         totalRead = 0 ifTrue: [
> >>             byte1 := buffer first.
> >>         ].
> >>         totalRead := totalRead + readCount.
> >>
> >>         outputStream ifNil: [
> >>             inputStream atEnd
> >>                 ifTrue: [ ^ buffer copyFrom: 1 to: readCount ]
> >>                 ifFalse: [ outputStream := (species new: bufferSize)
> >> writeStream ] ].
> >>         outputStream next: readCount putAll: buffer startingAt: 1.
> >>         byte1 = outputStream contents first ifFalse: [ self halt ].
> >>     ].
> >>     answer := outputStream ifNil: [ species new ] ifNotNil: [
> >> outputStream contents ].
> >>     byte1 = answer first ifFalse: [ self halt ].    ^answer
> >> --


More information about the Vm-dev mailing list