[Seaside] random maddening bug - "corrupted" file upload contents
cy.delaunay at gmail.com
Wed Jan 17 15:49:45 UTC 2018
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
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
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>:
> 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.
> self test4
> | species bufferSize buffer totalRead outputStream answer inputStream
> ba byte1 |
> false ifTrue: [
> ba := (FileStream readOnlyFileNamed: '/Users/bob/z99.zip') binary;
> ] 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:
> 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 ].
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside