After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686213 - Half open TCP sockets remain open after soup_session_abort
Half open TCP sockets remain open after soup_session_abort
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.34.x
Other Linux
: Normal major
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-10-16 08:56 UTC by Przemysław Suliga
Modified: 2012-10-16 14:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fdleak.c (2.74 KB, text/x-csrc)
2012-10-16 08:56 UTC, Przemysław Suliga
Details

Description Przemysław Suliga 2012-10-16 08:56:44 UTC
Created attachment 226530 [details]
fdleak.c

Hi,

lsof reports opened file descriptors after `soup_session_abort`.

HOW TO REPRODUCE:
1. create async soup session
2. enqueue a request to a service resulting in an long lasting embryonic connection state (http://en.wikipedia.org/wiki/TCP_half-open) example: try to connect to a service behind a firewall. netstat will report SYN_SENT state for this connection.
3. call soup_session_abort after a while

EXPECTED OUTCOME:
All sockets are closed. lsof shows no FDs of sockets used in session

ACTUAL OUTCOME:
SYN_SENT state sockets remain open, OS decides it is no longer a tcp connection. lsof shows FDs with "cant't identify protocol" information.

ENVIRONMENT:
Tested on:
- Ubuntu 12.04 - libsoup 2.38.1-1
- Ubuntu 12.10 - libsoup 2.40.0

ADDITIONAL INFORMATION:
Attached is a simple application. When I run it like that:
    $ ./fdleak http://i-will-sent-syn_ack-host/ http://i-wont-sent-syn_ack-host/

it will:
1. create event loop, soup session, two messages.
2. enqueue messages, add a callback printing response headers
3. start event loop (first service will respond promptly, headers will be printed)
4. soup_session_abort will be called in a timeout callback after 3 seconds, after 5 seconds session will be cleaned up and event loop will quit.
5. socket trying to connect to second service will remain in SYN_SENT state. Later it will be reported as lsof as "cant't identify protocol" FD.


When a "timeout" property for session is set SYN_SENT sockets are closed after the timeout and everything is fine.
I noticed that "disconnected" signal is emited after calling soup_session_abort for appropriate number of soup-connection objects. Maybe the bug is somewhere in `soup_socket_disconnect`.

Thanks and Regards,
Przemysław Suliga
Comment 1 Dan Winship 2012-10-16 14:28:01 UTC
The bug was in glib, and is now fixed in master and the glib-2-34 branch, but unfortunately not in glib 2.34.1.