mattn / mruby-thread

48 stars 31 forks source link

Multithreaded TCPServer crashes immediately #64

Open Gundolf68 opened 4 years ago

Gundolf68 commented 4 years ago

Was: https://github.com/mruby/mruby/issues/4949

This:

server = TCPServer.open(8000)    
loop do                          
    Thread.start(server.accept) do |client|
        client.write "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\nContent-Length: 11\r\n\r\nHello world"
        client.close                  
    end
end

on Ubuntu 18.04. At the first request, the program exits with a Segmentation fault.