[Seaside] random maddening bug - "corrupted" file upload contents

Bob Arning arning315 at comcast.net
Wed Jan 17 16:08:11 UTC 2018


The precise point of failure seems to vary - sometimes when growing and 
sometimes at the final "outputStream contents". In either case, copying 
data from one very large ByteArray to another is involved.

I strongly suspect that this is a vm issue, so the first approach would 
be to replace the vm you are using with a newer (stable) vm and see if 
that fixes it. If it doesn't, then mentioning the problem either on the 
pharo list or the vm list would seem like the next step.


On 1/17/18 10:49 AM, Cyrille Delaunay wrote:
> thanks bob for digging into this issue.
> if I sum up what I understood from your debugging and test session:
>
> => a corruption occurs while reading an input stream with method 
> ZnUtils class>>readUpToEnd:limit:
> You confirm that the corruption alter the first 4 bytes of the input 
> stream
>
> => the first 4 bytes are initially correctly written to an outputStream.
> But, the first 4 bytes of this outputStream gets altered (corrupted) 
> when the inner byte array grows from 18184052 to 22732263
> The grow of the inner byte array would be automatically triggered by 
> execution of method: #next:putAll:startingAt:
>
> => You have been able to write a piece of code that highlight this 
> issue (still randomely)
>
>
> So the lower level method (that we have been able to spot) triggering 
> an unexpected behavior  would be #next:putAll:startingAt:
> Am I Right ?
> So we would start to dive into the guts of Pharo.
>
> Should I open an issue somewhere ?
>
>
>
>
> 2018-01-11 2:41 GMT+01:00 Bob Arning <arning315 at comcast.net 
> <mailto:arning315 at comcast.net>>:
>
>     I've been able to boil it down to one method. This fails sometimes
>     and succeeds sometimes. Whichever it does, it tends to keep doing
>     that for a while. Quitting and restarting may get it to change.
>
>     test4
>     "
>     self test4
>     "
>         | species bufferSize buffer totalRead outputStream answer
>     inputStream ba byte1 |
>
>         false ifTrue: [
>             ba := (FileStream readOnlyFileNamed: '/Users/bob/z99.zip')
>     binary; contentsOfEntireFile.
>          ] ifFalse: [
>             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 firstByte ifFalse: [ self halt ].
>         ].
>         answer := outputStream ifNil: [ species new ] ifNotNil: [
>     outputStream contents ].
>         byte1 = answer first ifFalse: [ self halt ].
>         ^answer
>
>
>     On 1/10/18 4:42 AM, Cyrille Delaunay wrote:
>>
>>     Has anyone been able to reproduce my little scenario ?
>>     As a reminder, suspicion is that something "wrong" has been
>>     introduced with Pharo6
>
>
>     _______________________________________________
>     seaside mailing list
>     seaside at lists.squeakfoundation.org
>     <mailto:seaside at lists.squeakfoundation.org>
>     http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>     <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>
>
>
>
> -- 
> Cyrille Delaunay
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20180117/cbc1d6b9/attachment-0001.html>


More information about the seaside mailing list