#1651 net.http.server calls response:on_destroy multiple times

Reporter TobiasH
Owner Nobody
Created
Updated
Stars ★ (1)
Tags
  • Status-NeedInfo
  • Priority-Medium
  • Type-Defect
  1. TobiasH on

    What steps will reproduce the problem? - I'm not exactly sure how to best trigger this. - For some reason not understood yet this did not happen in our software stack in the past. What is the expected output? - net.http.server calls response:on_destroy only once for a given response/connection. What do you see instead? - It is sometimes called twice (could possibly be even more often, as listerner.ondisconnect seems to be possibly called multiple times. What version of the product are you using? On what operating system? Prosody 0.11.8 Linux Please provide any additional information below. 1. Here it works: https://github.com/bjc/prosody/blob/master/net/http/server.lua#L392 response.finished is checked, also response.on_destroy is set to nil 2. Here it does not work (although re-invocation via 1. is prevented): https://github.com/bjc/prosody/blob/master/net/http/server.lua#L148 This sets .finished, but, when invoked multiple times (which does happen, I'm just not sure, how to best reproduce this), will call on_destroy *each time*. Any module code (in our case, a custom mod_eventsource provider used by a custom event logging module) hooking on_destroy has no benefit from being called multiple times.

  2. Zash on

    Thanks for the report. FYI Prosody is not hosted on Github. Which network backend is used? Ie. is `use_libevent` or `network_backend` set? The default if neither are set is "select". There are some related issues related to socket callbacks and the order they are called in: #528 #1419 If ondisconnect is called multiple times then that's a bug.

    Changes
    • title prosody1@thax.hardliners.org net.http.server calls response:on_destroy multiple times
    • tags Status-NeedInfo
  3. TobiasH on

    We have network_backend = "epoll"

  4. TobiasH on

    And use_libevent = true is actually also set... From the log: startup info Prosody is using the libevent epoll backend for connection handling

  5. Zash on

    network_backend is apparently ignored when use_libevent = true

New comment

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