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
The code below simulates the seg fault mentioned in #3437 . It models the typical flow in multi.jl.
To simulate :
Copy and execute the below code in a Julia session
function accept_sock(server::Base.TcpServer, status::Int32)
if(status == -1)
error("An error occured during the creation of the server")
end
sock = Base.accept_nonblock(server)
process_sock(sock)
end
function add_to_workq(t::Task)
ccall(:uv_stop,Void,(Ptr{Void},),Base.eventloop())
unshift!(Base.Workqueue, t)
end
function process_sock(sock::AsyncStream)
add_to_workq(@task begin
start_reading(sock)
Base.wait_connected(sock)
println("After wait_connected")
try
while true
c=read(sock, Uint8)
print(c)
end
catch e
println("Caught exception $e")
stop_reading(sock)
return nothing
end
end)
end
(actual_port,sock) = open_any_tcp_port(accept_sock,8000)
println(dec(actual_port))
Open at least 3 telnet connections to the port printed above using telnet localhost 8000
tickle all the connections by typing any keys in the telnet sessions
execute killall telnet
On the Julia session you should see :
julia> (actual_port,sock) = open_any_tcp_port(accept_sock,8000)
(0x1f40,TcpServer(listening))
julia> println(dec(actual_port))
8000
julia> After wait_connected
After wait_connected
After wait_connected
0x610x0d0x0a0x620x0d0x0a0x630x0d0x0aCaught exception EOFError()
Caught exception EOFError()
Segmentation fault
If you remove stop_reading(sock) in the exception handler in process_sock the seg fault goes away.
After receiving an EOF, the stream is closed and invalid for any further operations. The functions in base need to be better about checking the state of the stream before doing operations on them, to avoid this sort of behavior.
The code below simulates the seg fault mentioned in #3437 . It models the typical flow in
multi.jl
.To simulate :
telnet localhost 8000
killall telnet
If you remove
stop_reading(sock)
in the exception handler inprocess_sock
the seg fault goes away.cc: @JeffBezanson , @loladiro
The text was updated successfully, but these errors were encountered: