Go to file
Fabian Grünbichler f737984826 fix #4816: do not disconnect twice if client sends no data
client_do_disconnect expects to be called exactly once per connection, since it
takes care of closing and unsetting the handle corresponding to the connection.
to find bugs in our connection handling, it will log "detected empty handle" if
it is called for a request/connection that no longer has a handle.

the edge case of opening a connection without sending any data leads to the
error callback being called twice:

Dec 04 09:37:02 xxx pveproxy[175235]: err (): Connection timed out

this is the (5 second) timeout triggering

Dec 04 09:37:02 xxx pveproxy[175235]: err (1): Broken pipe

this is AnyEvent trying to drain the buffer while the connection is already
closed

as soon as a single byte of traffic is sent, only the timeout will trigger.

there is no guarantee that the on_error callback is only called once (in fact,
it's possible to return from it for non-fatal errors and continue processing
the connection).

if there are further reports of empty handles with this in place, other
on_error callbacks might need similar logic - but it should only be added if
the triggering conditions are clear and deemed safe. the additional logging is
only cosmetic after all, but might point out an actual issue in our connection
handling code.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2025-01-28 15:28:47 +01:00
debian bump version to 5.1.2 2024-10-04 14:03:00 +02:00
src fix #4816: do not disconnect twice if client sends no data 2025-01-28 15:28:47 +01:00
.gitignore fixup no newline at end of .gitignore 2018-05-25 16:42:05 +02:00
Makefile fixup! buildsys: add sbuild target for convenience 2023-05-17 07:31:38 +02:00