diff options
author | Matthew Wild <mwild1@gmail.com> | 2025-03-31 16:25:09 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2025-03-31 16:25:09 +0100 |
commit | 4f94d2425d03c983e8071c67f15de9af4191d9b4 (patch) | |
tree | 072e50a0c76f54a4ba8e71d4abe1bdd79d8c1ee3 /util | |
parent | 96aadab60bb391c7b88091659f89a8e176036538 (diff) | |
download | prosody-4f94d2425d03c983e8071c67f15de9af4191d9b4.tar.gz prosody-4f94d2425d03c983e8071c67f15de9af4191d9b4.zip |
util.adminstream: Fix traceback on double-close (fixes #1913)
In some circumstances, particularly with 'opportunistic_writes' and
'fatal_errors' enabled in the epoll backend, the connection may be closed
halfway through the session close process (because it contains debug logging,
which in the case of the watch:log() command, will trigger a write to the
socket).
The chosen fix is to cache session.conn in a local variable (we already did
this later on, but this pulls it up to the top of the function, which is
generally more correct anyway).
Diffstat (limited to 'util')
-rw-r--r-- | util/adminstream.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/adminstream.lua b/util/adminstream.lua index 5387c906..8e32a91d 100644 --- a/util/adminstream.lua +++ b/util/adminstream.lua @@ -82,7 +82,8 @@ end local function session_close(session, reason) local log = session.log or log; - if session.conn then + local conn = session.conn; + if conn then if session.notopen then session:open_stream(); end @@ -115,7 +116,6 @@ local function session_close(session, reason) session.log("debug", "c2s stream for %s closed: %s", session.full_jid or session.ip or "<unknown>", reason_text or "session closed"); -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote - local conn = session.conn; if reason_text == nil and not session.notopen and session.type == "c2s" then -- Grace time to process data from authenticated cleanly-closed stream add_task(stream_close_timeout, function () |