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
--- Socket = require 'luasocket'--- local server = Socket.tcp()server:bind('127.0.0.1', 3000)
server:listen()
whiletruedor, w, errIO.select({server}, nil, 1)
if#r>0ifr[1] ==serverthenlocalclient=server:accpet() -- previous closed client is successfully accepted but this client had closed by ruby already.-- You accept A ZOMBIE SOCKET!!!msg1, err, msg2=client.receive()
client.send(msg1ormsg2)
client.close()
endendend
Client only connect The SERVER by 1 TIME.
But Server Would Accept more Than 1 TIME
I mean:
Server -> select()
Client -> connect()
Server -> accept
Client -> send() -> close()
Server -> receive() -> send(response) -> close()
Server -> select()
Server -> accept() -- HERE is the problem, now no client is doing connect().
-- But a GHOST socket being accept()
Express.js and Ruby on Rails Don't have such problem.
Only luasocket have this bug.
The text was updated successfully, but these errors were encountered:
jakitliang
changed the title
tcp.accept sometimes accept a previous closed remote connection.
tcp.accept can sometimes accept ZOMBIE SOCKETs (previous closed remote connection).
Sep 29, 2023
jakitliang
changed the title
tcp.accept can sometimes accept ZOMBIE SOCKETs (previous closed remote connection).
tcp.accept can sometimes accept GHOST SOCKETs (previous closed remote connection).
Sep 30, 2023
You can test it with your local
irb
orpython
ornodejs
as a client.Client only connect The SERVER by 1 TIME.
But Server Would Accept more Than 1 TIME
I mean:
Express.js
andRuby on Rails
Don't have such problem.Only
luasocket
have this bug.The text was updated successfully, but these errors were encountered: