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

Alistair Grant akgrant0710 at gmail.com
Wed Jan 24 16:34:30 UTC 2018


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
>> --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AKG-Corruption.st
Type: application/octet-stream
Size: 2219 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180124/817dc53d/attachment.obj>


More information about the Vm-dev mailing list