Bug 4580 - SCTP association can get stuck in SCTP_STATE_SHUTDOWN_PENDING state forever
Summary: SCTP association can get stuck in SCTP_STATE_SHUTDOWN_PENDING state forever
Status: RESOLVED FIXED
Alias: None
Product: General Runtime
Classification: Runtime
Component: General Runtime (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.5
Assignee: Xufeng Zhang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-05-31 08:42 UTC by Xufeng Zhang
Modified: 2014-04-24 03:30 UTC (History)
1 user (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xufeng Zhang 2013-05-31 08:42:22 UTC
SCTP association can get stuck in SCTP_STATE_SHUTDOWN_PENDING state forever by
running the below test case:
#### Accept SCTP traffic on port 60001
iptables -t filter -I INPUT 3 -p sctp --dport 60001 -j ACCEPT
iptables -t filter -I OUTPUT 3 -p sctp --dport 60001 -j ACCEPT

#### SCTP parameters on A (slow detection of link failure)
net.sctp.association_max_retrans = 5
net.sctp.path_max_retrans = 5
net.sctp.hb_interval = 30000

#### SCTP parameters on B (fast detection of link failure)
net.sctp.association_max_retrans = 2
net.sctp.path_max_retrans = 2
net.sctp.hb_interval = 1000

Test Procedure
#### First setup SCTP link between two hosts

#### Send on A (interactive)
sctp_darn -H 10.19.205.32 -P 60001 -h 10.19.206.46 -p 60001 -I -s

#### Listen on B
sctp_darn -H 10.19.206.46 -P 60001 -h 10.19.205.32 -p 60001 -l &

#### Send on A to establish the SCTP association.
snd=5

#### Ensure the SCTP association is up on B
cat /proc/net/sctp/assocs

#### Block SCTP on B (simulates a network failure)
iptables -t filter -I INPUT 1 -p sctp --dport 60001 -j DROP
iptables -t filter -I OUTPUT 1 -p sctp --dport 60001 -j DROP
#### Quickly send data on A and then shutdown (A goes into SHUTDOWN_PENDING state)
snd=5
snd=5
shutdown

#### Wait for link to drop on B ("Recieved SCTP_COMM_LOST")
#### Quickly kill the listener, open the firewall for SCTP, then start an SCTP sender
kill $PROC_TO_KILL
iptables -t filter -D INPUT 1
iptables -t filter -D OUTPUT 1
sctp_darn -H 10.19.206.46 -P 60001 -h 10.19.205.32 -p 60001 -s

#### Press <ENTER> to send data to trigger sending INITs to A

#### Host A receives a RESTART indication and gives up on the SHUTDOWN
10.19.205.32:60001-10.19.206.46:60001 Interactive mode> snd=5
10.19.205.32:60001-10.19.206.46:60001 Interactive mode> snd=5
10.19.205.32:60001-10.19.206.46:60001 Interactive mode> shutdown
Recieved SCTP_RESTART
SHUTDOWN failed

#### Association on A remains in SHUTDOWN_PENDING (5) state indefinitely
cat /proc/net/sctp/assocs
ASSOC     SOCK   STY SST ST HBKT ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT RPORT LADDRS <-> RADDRS HBINT INS OUTS MAXRT T1X T2X RTXC
d7190000 e3171180 0   7   5  35723    1        0        0       0     0 60001 60001  *10.19.205.32 <-> *10.19.206.46             30000    10    10    5    0    0        7
Comment 1 Xufeng Zhang 2014-04-24 03:30:00 UTC
This fix has already been merged.