#528 server_select and server_event call different callbacks on connection failure

Reporter Zash
Owner MattJ
Stars (0)
  • Type-Defect
  • Priority-Medium
  • Status-Started
  1. 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.

  2. 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...

  3. MattJ on

    The server_event behaviour is what was intended.

  4. Zash on

    Fixed in http://hg.prosody.im/0.10/rev/32327c80710b for the server_select issue.

    • tag Status-Started
  5. Zash on

    There's still the select+c2s issue.

  6. Zash on

    • title statsmanager / util.statistics acting weird server_select and server_event call different callbacks on connection failure
  7. 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()

  8. 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()

  9. Zash on

    • owner Zash
  10. 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.

    • owner Zash MattJ

New comment

Not published. Used for spam prevention and optional update notifications.