#1651 net.http.server calls response:on_destroy multiple times
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:
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):
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.
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.
We have network_backend = "epoll"
And use_libevent = true is actually also set...
From the log:
startup info Prosody is using the libevent epoll backend for connection handling
network_backend is apparently ignored when use_libevent = true