Note that there are some explanatory texts on larger screens.

plurals
  1. POHandling chunked request in Sinatra
    primarykey
    data
    text
    <p>In Sinatra I have a route setup similar to the following:</p> <pre><code>put '/test' do begin logger.info 'In put begin block' write_to_file(request.body.read) [200, ''] rescue RuntimeError =&gt; e [500, 'some error'] end end def write_to_file(data) logger.info "writing data with size #{data.size}" # Code to save file... end </code></pre> <p>When I send data that is &lt; ~500 MBytes it everything seems to work correctly but when I attempt to send data that is >= 500 MBytes I get some weird log output and then the client eventually errors out with the following error: Excon::Errors::SocketError: EOFError (EOFError)</p> <p>The logs from the server (Sinatra) look like the following:</p> <p>For data &lt; 500 MBytes:</p> <pre><code>I, [2013-01-07T21:33:59.386768 #17380] INFO -- : In put begin block I, [2013-01-07T21:34:01.279922 #17380] INFO -- : writing data with size 209715200 xxx.xxx.xxx.xxx - - [07/Jan/2013 21:34:22] "PUT /test " 200 - 22.7917 </code></pre> <p>For data > 500 MBytes:</p> <pre><code>I, [2013-01-07T21:47:37.434022 #17386] INFO -- : In put begin block I, [2013-01-07T21:47:41.152932 #17386] INFO -- : writing data with size 524288000 I, [2013-01-07T21:48:16.093683 #17380] INFO -- : In put begin block I, [2013-01-07T21:48:20.300391 #17380] INFO -- : writing data with size 524288000 xxx.xxx.xxx.xxx - - [07/Jan/2013 21:48:39] "PUT /test " 200 - 62.4515 I, [2013-01-07T21:48:54.718971 #17386] INFO -- : In put begin block I, [2013-01-07T21:49:00.381725 #17386] INFO -- : writing data with size 524288000 I, [2013-01-07T21:49:33.980043 #17267] INFO -- : In put begin block I, [2013-01-07T21:49:41.990671 #17267] INFO -- : writing data with size 524288000 xxx.xxx.xxx.xxx - - [07/Jan/2013 21:50:06] "PUT /test " 200 - 110.2076 xxx.xxx.xxx.xxx - - [07/Jan/2013 21:51:22] "PUT /test " 200 - 108.5339 </code></pre> <p>Not entirely sure whats going on here so I guess my question is two fold, A. What is fundamentally different between these two cases that would cause them to behave this way? B. Is there a better way to handle data to mitigate against this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload