When I try to run one of my rake where I read body from my response,
each time I've got this error message:
.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/net/http.rb:2788:in
`stream_check': undefined method `closed?' for nil:NilClass
(NoMethodError)
I checked that place and there is:
2788 raise IOError, 'attempt to read body out of block' if @socket.closed?
to fix the problem I just change it to:
2788 raise IOError, 'attempt to read body out of block' if @socket and @socket.closed?
I found few similar problems on some forums but it was in different
places but the bugfix is always the same, check @socket before @socket.closed?
There is also few more place in http.rb where @socked.closed? appear
with checking @socket:
1335 connect if @socket.closed?
...
1344 if @socket.closed?
I am not sure but it will be good to fix them all.
What are you wanting fixed? As I'm reading your issue, a nil is seen and appropriately raises an undefined method error.
If you can resolve the circumstances under which nil sockets can possibly occur, you have a permanent solution. Til then, you should check for nils.
Jamandbees.
···
On 25 Oct 2012, at 04:05, Robert Mitwicki <robert.mitwicki@fxitech.com> wrote:
Hi
When I try to run one of my rake where I read body from my response,
each time I've got this error message:
.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/net/http.rb:2788:in
`stream_check': undefined method `closed?' for nil:NilClass
(NoMethodError)
I checked that place and there is:
2788 raise IOError, 'attempt to read body out of block' if @socket.closed?
to fix the problem I just change it to:
2788 raise IOError, 'attempt to read body out of block' if @socket and @socket.closed?
I found few similar problems on some forums but it was in different
places but the bugfix is always the same, check @socket before @socket.closed?
There is also few more place in http.rb where @socked.closed? appear
with checking @socket:
1335 connect if @socket.closed?
...
1344 if @socket.closed?
I am not sure but it will be good to fix them all.
I understand that, but I do not know exactly when and why @socket is
created. I didn't debug it as much. Right now I see that in most part
of this code (in http.rb) there is a if statement to check if @socket
is not nil, before using @socket.closed? but not in this two cases as
I mention in first post. So I assume that someone already figure out
why is like that and he prevent to crash in other places but forget
about this two.
Maybe you know when @socket will be created and how to prevent code to
crash in that cases?
Best regards
···
On Sat, Oct 27, 2012 at 4:41 AM, Jam Bees <jam@jamandbees.net> wrote:
On 25 Oct 2012, at 04:05, Robert Mitwicki <robert.mitwicki@fxitech.com> wrote:
Hi
When I try to run one of my rake where I read body from my response,
each time I've got this error message:
.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/net/http.rb:2788:in
`stream_check': undefined method `closed?' for nil:NilClass
(NoMethodError)
I checked that place and there is:
2788 raise IOError, 'attempt to read body out of block' if @socket.closed?
to fix the problem I just change it to:
2788 raise IOError, 'attempt to read body out of block' if @socket and @socket.closed?
I found few similar problems on some forums but it was in different
places but the bugfix is always the same, check @socket before @socket.closed?
There is also few more place in http.rb where @socked.closed? appear
with checking @socket:
1335 connect if @socket.closed?
...
1344 if @socket.closed?
I am not sure but it will be good to fix them all.
Best regards
mtfk
What are you wanting fixed? As I'm reading your issue, a nil is seen and appropriately raises an undefined method error.
If you can resolve the circumstances under which nil sockets can possibly occur, you have a permanent solution. Til then, you should check for nils.
Jamandbees.
--
Robert Mitwicki
Senior Software Engineer
FXI Technologies