<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-01-02 17:37 GMT+01:00 Sven Van Caekenberghe <span dir="ltr"><<a href="mailto:sven@stfx.eu" target="_blank">sven@stfx.eu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
> On 2 Jan 2018, at 12:53, Cyrille Delaunay <<a href="mailto:cy.delaunay@gmail.com">cy.delaunay@gmail.com</a>> wrote:<br>
><br>
> Hi Sven,<br>
><br>
> I am back on this issue :)<br>
><br>
> I have kind of a "clean" scenario that could help to reproduce.<br>
> It is still random, but at one point, it shows up for me.<br>
><br>
> Here is how I am doing:<br>
> Download Pharo 6.1 on my Mac (Sierra 10.12.6): <a href="https://pharo.org/web/download" rel="noreferrer" target="_blank">https://pharo.org/web/download</a><br>
> Then, iterate over this process till spotting the issue:<br>
><br>
> => start the pharo image<br>
> => execute this piece of code in a playground<br>
><br>
> ZnServer startDefaultOn: 1701.<br>
> ZnServer default maximumEntitySize: 80* 1024 * 1024.<br>
> '/Users/cdelaunay/myzip.zip' asFileReference writeStreamDo: [ :out |<br>
> out binary; nextPutAll: #[80 75 3 4 10 0 0 0 0 0 125 83 67 73 0 0 0 0 0 0].<br>
> 18202065 timesRepeat: [ out nextPut: 0 ]<br>
> ].<br>
><br>
> => Open a web browser page on: <a href="http://localhost:1701/form-test-3" rel="noreferrer" target="_blank">http://localhost:1701/form-<wbr>test-3</a><br>
> => Upload the file zip file previously generated ('myzip.zip').<br>
> => If the web page displays: "contents=000000000a00..." (or anything unexpected), THIS IS THE ISSUE !<br>
> => If the web page displays: "contents=504b03040a00..", the upload worked fine. You can close the image (without saving)<br>
><br>
> Mettre à jour Saisir temps Surveiller Copier Supprimer<br>
><br>
><br>
> Usually, after starting 3 / 4 times pharo image, I am getting the problem.<br>
> I have been able to reproduce with chrome and firefox.<br>
><br>
><br>
> Seing that I was able to reproduce within a fresh pharo image, I tried to automate this scenario.<br>
> I wrote the following test:<br>
><br>
><br>
> ZnServerTests >>testFormTest4<br>
>       | inputs client part fileReference fileContents entity |<br>
>       fileReference := 'test-zip.zip' asFileReference.<br>
>       fileReference<br>
>               writeStreamDo: [ :out |<br>
>                       out<br>
>                               binary;<br>
>                               nextPutAll: #[80 75 3 4 10 0 0 0 0 0 125 83 67 73 0 0 0 0 0 0].<br>
>                       18202065 timesRepeat: [ out nextPut: 0 ] ].<br>
>       fileContents := fileReference binaryReadStreamDo: [ :in | in upToEnd ].<br>
>       15<br>
>               timesRepeat: [ self<br>
>                               withServerDo: [ :server |<br>
>                                       server maximumEntitySize: 80 * 1024 * 1024.<br>
>                                       server debugMode: true.<br>
>                                       (client := ZnClient new)<br>
>                                               url: server localUrl;<br>
>                                               addPathSegment: 'form-test-3'.<br>
>                                       client timeout: 120000.<br>
>                                       entity := (ZnByteArrayEntity type: (ZnMimeType main: 'application' sub: 'zip') length: fileContents size) bytes: fileContents.<br>
>                                       part := ZnMimePart fieldName: 'file' fileName: fileReference basename entity: entity.<br>
>                                       client<br>
>                                               resetEntity;<br>
>                                               addPart: part;<br>
>                                               post.<br>
>                                       self assert: client isSuccess.<br>
>                                       self assert: (client contents includesSubstring: '504b03040a') ] ]<br>
><br>
><br>
><br>
><br>
> In order to make this test run correctly I had to modify this method.<br>
> Without this change, I always got an empty html page as response<br>
><br>
><br>
><br>
> ZnDefaultServerDelegate >> formTest3: request<br>
>       | contents filename contentType page |<br>
>       contents := filename := contentType := ''.<br>
>       (request hasEntity and: [ request contentType matches: ZnMimeType multiPartFormData ])<br>
>               ifTrue: [<br>
>                       (request entity partNamed: #file ifNone: [ nil ])<br>
>                               ifNotNil: [ :part |<br>
>                                       filename := part fileName.<br>
>                                       contents := part contents.<br>
>                                       contentType := part  contentType.<br>
>                                       contentType isBinary ifTrue: [ contents := contents hex ] ] ].<br>
>       page := ZnHtmlOutputStream streamContents: [ :html |<br>
>               html page: 'Form Test 3' do: [<br>
>                       html<br>
>                               tag: #form<br>
>                               attributes: #(action 'form-test-3' 'accept-charset' 'utf-8'<br>
>                                                                       enctype 'multipart/form-data' method POST)<br>
>                               do: [<br>
>                                       html<br>
>                                               str: 'File'; space;<br>
>                                               tag: #input attributes: #(type file name file); space;<br>
>                                               tag: #input attributes: #(type submit) ];<br>
>                               tag: #p do: [ html str: 'filename = '; str: filename ];<br>
>                               tag: #p do: [ html str: 'content-type = '; str: contentType asString ];<br>
>                               tag: #p do: [ html str: 'contents = '; str: (contents copyFrom: 1 to: 20) asString ] ] ].<br>
>       ^ ZnResponse ok: (ZnEntity html: page)<br>
><br>
><br>
><br>
> Unfortunately, the tests always passed till now !<br>
<br>
</div></div>So you have to upload 80Mb ?<br></blockquote><div><br></div><div>Sometimes yes.</div><div>But here the file I build and use to reproduce is only 18 mb. </div><div>(the same size as the original file highlighting the issue on my machine).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And if you script it in Pharo and repeat it 15 times it keeps on working ?<br>
Really ?<br></blockquote><div><br></div><div>Yes indeed.</div><div>But again, it is completely random.</div><div>I could not ensure that the problem would never show up with the script.</div><div>I will try to make more tries tomorrow.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
It seems that it only fails when a manually operated browser is involved.<br></blockquote><div><br></div><div>Yes, exactly</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Have you tried doing the upload with curl ?<br></blockquote><div><br></div><div>No.</div><div>How would I do that ?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> I will try to go on refining the context parameters that could make the issue show up or not<br>
><br>
><br>
><br>
> 2017-12-22 18:05 GMT+01:00 Sven Van Caekenberghe <<a href="mailto:sven@stfx.eu">sven@stfx.eu</a>>:<br>
> Well, I can't repeat it, for now.<br>
><br>
> Try to make a minimal self-contained example that fails (reliably), like how I did it, you can even try to do the upload in Pharo too (see #testFormTest3).<br>
><br>
> > On 22 Dec 2017, at 18:00, Cyril Ferlicot <<a href="mailto:cyril.ferlicot@gmail.com">cyril.ferlicot@gmail.com</a>> wrote:<br>
> ><br>
> ><br>
> > On ven. 22 déc. 2017 at 17:50, Sven Van Caekenberghe <<a href="mailto:sven@stfx.eu">sven@stfx.eu</a>> wrote:<br>
> > Cyrille,<br>
> ><br>
> > I wrote a file like this:<br>
> ><br>
> > FileLocator temp / 'myzip.zip' writeStreamDo: [ :out |<br>
> >   out binary; nextPutAll: #[80 75 3 4 10 0 0 0 0 0 125 83 67 73 0 0 0 0 0 0] ].<br>
> ><br>
> > Which I can read as follows:<br>
> ><br>
> > FileLocator temp / 'myzip.zip' binaryReadStreamDo: [ :in | in upToEnd ].<br>
> ><br>
> >   => #[80 75 3 4 10 0 0 0 0 0 125 83 67 73 0 0 0 0 0 0]<br>
> ><br>
> > If I upload this file to <a href="http://localhost:1701/form-test-3" rel="noreferrer" target="_blank">http://localhost:1701/form-<wbr>test-3</a> this works perfectly (macOS 10.13.2 Pharo #60402, Safari. Firefox & Chrome), first time and second time.<br>
> ><br>
> ><br>
> ><br>
> > Maybe you should try on a co-workers machine just to make sure it is not a local problem on your machine ?<br>
> ><br>
> > Hi Sven,<br>
> ><br>
> > It happen on Cyrille's machine, my machine, Yann's machine and our boss's machine.<br>
> ><br>
> > We first saw it on Windows and never on mac/Linux. But now we see it also on mac.<br>
> ><br>
> > I did not see it yet on Linux but we use it less for now.<br>
> ><br>
> > Also, when it happen, it tend to happen a lot afterward.<br>
> ><br>
> > Also, by random it means that we can have 1/2 week without problem, then 4 failure in 2h.<br>
> ><br>
> ><br>
> ><br>
> > Sven<br>
> ><br>
> > --<br>
> > Cyril Ferlicot<br>
> > <a href="https://ferlicot.fr" rel="noreferrer" target="_blank">https://ferlicot.fr</a><br>
> ><br>
> > <a href="http://www.synectique.eu" rel="noreferrer" target="_blank">http://www.synectique.eu</a><br>
> > 2 rue Jacques Prévert 01,<br>
> > 59650 Villeneuve d'ascq France<br>
> > <Screen Shot 2017-12-22 at 17.48.31.png>_________________<wbr>______________________________<br>
> > seaside mailing list<br>
> > <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.<wbr>squeakfoundation.org</a><br>
> > <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
><br>
> ______________________________<wbr>_________________<br>
> seaside mailing list<br>
> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.<wbr>squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
><br>
><br>
><br>
> --<br>
> Cyrille Delaunay<br>
> ______________________________<wbr>_________________<br>
> seaside mailing list<br>
> <a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.<wbr>squeakfoundation.org</a><br>
> <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
<br>
______________________________<wbr>_________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
</div></div></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></div>