#528 server_select and server_event call different callbacks on connection failure
Reporter
Zash
Owner
MattJ
Created
Updated
Stars
(0)
Tags
Priority-Medium
Type-Defect
Status-Started
Zash
on
This is a graph of the number of s2s connections:
http://h45h.com/gM_16y0eRVVNhE_a2ujZCVmXK2fMmVlKx2zztSTinz4=
After some time, they start going negative for some reason.
With libevent, this happens to s2s connection stats, with select, it happens to c2s.
Zash
on
Looks like server_event calls ondisconnect but not onconnect for failed connection attempts, while server_select calls onconnect even if the connection fails...
titlestatsmanager / util.statistics acting weird server_select and server_event call different callbacks on connection failure
Zash
on
Test:
server.addclient( some host, some port not being listened to, listener, ... )
Expect:
something, then
listener.ondisconnect(conn, "connection refused")
On server_select, see:
listener.onconnect()
listener.ondrain()
listener.ondisconnect()
On server_event, see:
listener.onconnect()
listener.ondisconnect()
Zash
on
Test:
server.addclient( black hole, ... )
Expect:
listener.ontimeout()
listener.ondisconnect()
On server_select, see:
listener.onconnect()
listener.ondrain()
listener.onincoming()
listener.ondisconnect(conn, "closed")
On server_event, see:
listener.ontimeout()
listener.ondisconnect()
Zash
on
Changes
owner Zash
Zash
on
On current trunk (hg:28755107c2f4) it appears server_select has the following listener order with a remote server that doesn't respond:
listener.onincoming(conn, "") -- yes, the empty string, yes, before onconnect
listener.onconnect()
listener.ondrain()
listener.ondisconnect(conn, "closed")
This causes problems in net.connect: #1419
My proposed final solution to this is to deprecate server_select and have server_epoll as default.
This is a graph of the number of s2s connections: http://h45h.com/gM_16y0eRVVNhE_a2ujZCVmXK2fMmVlKx2zztSTinz4= After some time, they start going negative for some reason. With libevent, this happens to s2s connection stats, with select, it happens to c2s.
Looks like server_event calls ondisconnect but not onconnect for failed connection attempts, while server_select calls onconnect even if the connection fails...
The server_event behaviour is what was intended.
Fixed in http://hg.prosody.im/0.10/rev/32327c80710b for the server_select issue.
ChangesThere's still the select+c2s issue.
statsmanager / util.statistics acting weirdserver_select and server_event call different callbacks on connection failureTest: server.addclient( some host, some port not being listened to, listener, ... ) Expect: something, then listener.ondisconnect(conn, "connection refused") On server_select, see: listener.onconnect() listener.ondrain() listener.ondisconnect() On server_event, see: listener.onconnect() listener.ondisconnect()
Test: server.addclient( black hole, ... ) Expect: listener.ontimeout() listener.ondisconnect() On server_select, see: listener.onconnect() listener.ondrain() listener.onincoming() listener.ondisconnect(conn, "closed") On server_event, see: listener.ontimeout() listener.ondisconnect()
On current trunk (hg:28755107c2f4) it appears server_select has the following listener order with a remote server that doesn't respond: listener.onincoming(conn, "") -- yes, the empty string, yes, before onconnect listener.onconnect() listener.ondrain() listener.ondisconnect(conn, "closed") This causes problems in net.connect: #1419 My proposed final solution to this is to deprecate server_select and have server_epoll as default.
ChangesZashMattJ