[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:82721] Re: [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances
From:
Eric Wong <normalperson@...>
Date:
2017-09-08 23:50:14 UTC
List:
ruby-core #82721
cardoso_tiago@hotmail.com wrote:
> Buffers are indeed attached per socket, but I wouldn't say
> they are short-lived. Also, I don't have guarantees that the
> same thread will handle the same socket after a wait, so I
> can't follow your advice. But I can also say that I haven't
> seen a big performance degradation because of it (although I'd
> appreciate suggestions on tools that could help me inspect
> this).
From your original post:
def read(io)
io.read_nonblock(16_384, @buffer, exception: false)
# do stuff...
@buffer.clear
end
It looks like @buffer only get used for the duration of the
method.
For common HTTP (and other TCP-based) servers, often you can
read an entire request with one read(2) syscall, do all parsing,
and discard the buffer ASAP (before even performing expensive
request parsing or response writing).
I only need to create a longer-lived buffer when a request is
big or trickled due to slowness.
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>