Bug 104301 - Connect failure on sctp socket under debug
Summary: Connect failure on sctp socket under debug
Status: NEW
Alias: None
Product: Networking
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Stephen Hemminger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-09 13:57 UTC by Riccardo Manfrin
Modified: 2016-02-15 20:45 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.13.0-63-generic
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Riccardo Manfrin 2015-09-09 13:57:38 UTC
When starting an sctp client with gdb, I experience a connect failure (-1 is returned), with errno 106 (Transport endpoint is already connected).

If I then cat /proc/net/sctp/assocs, I see the connection and I see the successful handshake on wireshark.

If I ignore the connect failure, and pretend I'm actually connected, I can send and receive packets without any trouble.

The same client application, run not-under-gdb, does not exhibits the issue and the connect returns 0.
Comment 1 Neil Horman 2015-09-09 15:15:39 UTC
Does the application in question have any signal handlers that are registered with SA_RESTART set?  My first thought would be that a call to sctp_connect might be aborted due to EINTR after the association has been set, but the syscall layer restarts the connect without the application knowing, leading to an EISCONN error even though is managed to connect.

If thats the case, not sure what the solution would be yet, but I image we have to catch or block EINTR somewhere in sctp_primitive_ASSOCIATE, or deeper in the state machine.
Comment 2 Riccardo Manfrin 2015-09-09 15:53:37 UTC
I could not find any registered signal handlers by the application (I also smelled that signals could be involved, but did not find any evidence).
Comment 3 Neil Horman 2015-09-09 17:51:09 UTC
can you attach a stap script to sctp_connect in the kernel, and see if its getting called multiple times?
Comment 4 Vlad Yasevich 2015-09-15 17:23:36 UTC
Or you could try:

echo -n "module sctp func sctp_connect +p" > /sys/kernel/debug/dynamic_debug/control

and try the gdb app.

There should be an entry in the log for ever attempt call sctp_connect.

Note You need to log in before you can comment on or make changes to this bug.