<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><font face="Georgia">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. <br>
      </font></p>
    <p><font face="Georgia">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.</font><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 1/17/18 10:49 AM, Cyrille Delaunay
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMEdb_AVQ5S3EC_0VBBS1MsdWVLXfNJ_8nzPEgB+egvhupYt3Q@mail.gmail.com">
      <div dir="ltr">thanks bob for digging into this issue.
        <div>if I sum up what I understood from your debugging and test
          session:</div>
        <div><br>
        </div>
        <div>=> a corruption occurs while reading an input stream
          with method <span style="font-family:Georgia;font-size:12.8px">ZnUtils
            class>>readUpToEnd:limit:</span><span
            style="font-family:Georgia;font-size:12.8px"> </span></div>
        <div><span style="font-family:Georgia;font-size:12.8px">You
            confirm that the corruption alter the first 4 bytes of the
            input stream</span></div>
        <div><span style="font-family:Georgia;font-size:12.8px"><br>
          </span></div>
        <div><span style="font-family:Georgia;font-size:12.8px">=>
            the first 4 bytes are initially correctly written to an
            outputStream.</span></div>
        <div><span style="font-family:Georgia;font-size:12.8px">But, the
            first 4 bytes of this outputStream gets altered (corrupted)
            when the inner byte array grows from </span><span
            style="font-size:12.8px">18184052 to 22732263</span></div>
        <div><span style="font-size:12.8px">The grow of the inner byte
            array would be automatically triggered by execution of
            method: #next:putAll:startingAt: </span></div>
        <div><br>
        </div>
        <div><span style="font-family:Georgia;font-size:12.8px">=>
            You have been able to write a piece of code that highlight
            this issue (still randomely)</span></div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>So the lower level method (that we have been able to spot)
          triggering an unexpected behavior  would be <span
            style="font-size:12.8px">#next:putAll:startingAt: </span></div>
        <div><span style="font-size:12.8px">Am I Right ?</span></div>
        <div><span style="font-size:12.8px">So we would start to dive
            into the guts of Pharo.</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">Should I open an issue
            somewhere ?</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-family:Georgia;font-size:12.8px"><br>
          </span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2018-01-11 2:41 GMT+01:00 Bob Arning <span
            dir="ltr"><<a href="mailto:arning315@comcast.net"
              target="_blank" moz-do-not-send="true">arning315@comcast.net</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <p><font face="Georgia">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.<br>
                </font></p>
              <p><font face="Georgia">test4<br>
                  "<br>
                  self test4<br>
                  "<br>
                      | species bufferSize buffer totalRead outputStream
                  answer inputStream ba byte1 |<br>
                      <br>
                      false ifTrue: [ <br>
                          ba := (FileStream readOnlyFileNamed:
                  '/Users/bob/z99.zip') binary; contentsOfEntireFile.<br>
                       ] ifFalse: [ <br>
                          ba := ByteArray new: 18202085.<br>
                          ba atAllPut: 99.<br>
                          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) ].<br>
                       ].<br>
                      inputStream := ba readStream.<br>
                      bufferSize := 16384.<br>
                      species := ByteArray.<span class=""><br>
                        buffer := species new: bufferSize.<br>
                        totalRead := 0.<br>
                        outputStream := nil. <br>
                        [ inputStream atEnd ] whileFalse: [ | readCount
                    |<br>
                            readCount := inputStream readInto: buffer
                    startingAt: 1 count: bufferSize.<br>
                            totalRead = 0 ifTrue: [<br>
                  </span>             byte1 := buffer first.<span
                    class=""><br>
                            ].<br>
                            totalRead := totalRead + readCount.<br>
                            <br>
                  </span><span class="">         outputStream ifNil: [ <br>
                                inputStream atEnd<br>
                                    ifTrue: [ ^ buffer copyFrom: 1 to:
                    readCount ] <br>
                                    ifFalse: [ outputStream := (species
                    new: bufferSize) writeStream ] ].<br>
                  </span><span class="">         outputStream next:
                    readCount putAll: buffer startingAt: 1.<br>
                  </span>         byte1 = outputStream firstByte
                  ifFalse: [ self halt ].<span class=""><br>
                        ].<br>
                        answer := outputStream ifNil: [ species new ]
                    ifNotNil: [ outputStream contents ].<br>
                  </span>     byte1 = answer first ifFalse: [ self halt
                  ].<br>
                      ^answer</font><br>
              </p>
              <span class=""> <br>
                <div class="m_7193136705468081967moz-cite-prefix">On
                  1/10/18 4:42 AM, Cyrille Delaunay wrote:<br>
                </div>
              </span><span class="">
                <blockquote type="cite">
                  <div><br>
                  </div>
                  <div>Has anyone been able to reproduce my little
                    scenario ?</div>
                  <div>As a reminder, suspicion is that something
                    "wrong" has been introduced with Pharo6</div>
                </blockquote>
                <br>
              </span></div>
            <br>
            ______________________________<wbr>_________________<br>
            seaside mailing list<br>
            <a href="mailto:seaside@lists.squeakfoundation.org"
              moz-do-not-send="true">seaside@lists.<wbr>squeakfoundation.org</a><br>
            <a
href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>Cyrille Delaunay</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>