GNU bug report logs - #62990
30.0.50; UDP server closes connection upon receiving an empty packet

Previous Next

Package: emacs;

Reported by: Vasilij Schneidermann <mail <at> vasilij.de>

Date: Fri, 21 Apr 2023 10:38:01 UTC

Severity: normal

Found in version 30.0.50

Full log


Message #8 received at 62990 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Vasilij Schneidermann <mail <at> vasilij.de>
Cc: 62990 <at> debbugs.gnu.org
Subject: Re: bug#62990: 30.0.50; UDP server closes connection upon receiving
 an empty packet
Date: Mon, 24 Apr 2023 10:51:06 +0200
>>>>> On Fri, 21 Apr 2023 12:36:52 +0200, Vasilij Schneidermann <mail <at> vasilij.de> said:

    Vasilij> I'm doing network programming with Emacs Lisp and one of the tasks was
    Vasilij> implementing a UDP server reading individual packets. I've found that
    Vasilij> when a client sends an empty packet, the server hangs up with a
    Vasilij> connection error and no longer accepts subsequent packets. This seems to
    Vasilij> be reasonable behavior for TCP (from what I understand, empty TCP
    Vasilij> messages are a sign of the connection being closed), but
    Vasilij> not for UDP.

Empty TCP messages are perfectly valid, but they should be hidden from
you. recvfrom returning 0 means the connection has been closed, but
thatʼs a separate thing.

Empty UDP messages are also valid, and are indicated by recvfrom returning
0.

Could you show how youʼre generating the empty packets?

    Vasilij> I've attached test programs written in Emacs Lisp and Guile to
    Vasilij> reproduce both correctly and incorrectly functioning servers and clients
    Vasilij> respectively. One minor nitpick is that sending an empty UDP packet from
    Vasilij> Emacs Lisp doesn't work either, but I'm unsure whether this is a bug
    Vasilij> (socat behaves similarly).

Itʼs allowed by the protocol. I guess it could be useful for people
wanting to implement their own keep-alive protocol over UDP.

Robert
-- 




This bug report was last modified 1 year and 157 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.