You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when process exists I call @server.shutdown but it hangs forever so that I have to send Ctrl+C. While debugging this issue I figured that def do_CONNECT(req, res) which binds a socket os = TCPSocket.new(host, port) sometimes in ensure block has os set to nil. Which leads me to a question if https://github.com/ruby/ruby/blob/55c771c302f94f1d1d95bf41b42459b4d2d1c337/ext/socket/ipsocket.c#L187 socket can be nil if we take into account inetsock_cleanup(VALUE v) which returns return Qnil;
I fixed the issue by adding raise HTTPStatus::EOFError unless os in ensure block so that we don't interact with the rest of descriptors. Other note is that none of the rescue blocks were called in do_CONNECT.
Update: I still assume that TCPSocket.new returns a socket or raises an error, but in my case I have no idea how I end up with nil as a socket even though we call thgroup.list.each{|th| th.join if th[:WEBrickThread] } in shutdown. Maybe because ruby starts to terminate all threads because main thread exits?
The text was updated successfully, but these errors were encountered:
I have a proxy server running in a thread:
when process exists I call
@server.shutdown
but it hangs forever so that I have to send Ctrl+C. While debugging this issue I figured thatdef do_CONNECT(req, res)
which binds a socketos = TCPSocket.new(host, port)
sometimes in ensure block hasos
set tonil
. Which leads me to a question if https://github.com/ruby/ruby/blob/55c771c302f94f1d1d95bf41b42459b4d2d1c337/ext/socket/ipsocket.c#L187 socket can benil
if we take into accountinetsock_cleanup(VALUE v)
which returnsreturn Qnil;
I fixed the issue by adding
raise HTTPStatus::EOFError unless os
in ensure block so that we don't interact with the rest of descriptors. Other note is that none of the rescue blocks were called indo_CONNECT
.Update: I still assume that
TCPSocket.new
returns a socket or raises an error, but in my case I have no idea how I end up with nil as a socket even though we callthgroup.list.each{|th| th.join if th[:WEBrickThread] }
in shutdown. Maybe because ruby starts to terminate all threads because main thread exits?The text was updated successfully, but these errors were encountered: