Subject: bin/10841: spray delays are not sufficiently granular
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 08/15/2000 17:59:33
>Number:         10841
>Category:       bin
>Synopsis:       spray delays are not sufficiently granular
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 15 18:00:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Hawkinson
>Release:        netbsd-1-5 of 13 July
>Organization:
MIT
>Environment:
	
System: NetBSD zorkmid.mit.edu 1.5E NetBSD 1.5E (ZORKMID-$Revision: 1.2 $) #38: Sun Aug 13 21:40:17 EDT 2000 jhawk@zorkmid.mit.edu:/usr/local/netbsd-current/src/sys/arch/i386/compile/ZORKMID i386


>Description:
	spray(8) makes it extremely difficult to usefully specify enough
delay/slop to make spray operate safely while still measuring usefully.

>How-To-Repeat:
	It seems that under some situations spray cannot work without
a delay:
zorkmid# spray 10.0.0.1
sending 1162 packets of lnth 86 to 10.0.0.1 ...spray: RPC: Unable to send; errno = No buffer space available

But adding hte minimum delay produces a result that seems
oddly suspicious to me:

zorkmid# spray -d 1 10.0.0.1
sending 1162 packets of lnth 86 to 10.0.0.1 ...
        in 23.27 seconds elapsed time
        no packets dropped
Sent:   50 packets/sec, 4.2K bytes/sec
Rcvd:   50 packets/sec, 4.2K bytes/sec
zorkmid# spray -d 2 10.0.0.1
sending 1162 packets of lnth 86 to 10.0.0.1 ...
        in 23.18 seconds elapsed time
        no packets dropped
Sent:   50 packets/sec, 4.2K bytes/sec
Rcvd:   50 packets/sec, 4.2K bytes/sec

So I suspect the delay is way too large. More delay samples:

zorkmid# spray -d 10 10.0.0.1
sending 1162 packets of lnth 86 to 10.0.0.1 ...
        in 23.27 seconds elapsed time
        1 packets (0.09%) dropped
Sent:   50 packets/sec, 4.2K bytes/sec
Rcvd:   50 packets/sec, 4.2K bytes/sec
zorkmid# spray -d 100 10.0.0.1
sending 1162 packets of lnth 86 to 10.0.0.1 ...
        in 966387211.46 seconds elapsed time
        259 packets (22.29%) dropped
Sent:   0 packets/sec, 0 bytes/sec
Rcvd:   0 packets/sec, 0 bytes/sec

Comparing this against localhost:

zorkmid# spray localhost
sending 1162 packets of lnth 86 to localhost ...
        in 0.08 seconds elapsed time
        no packets dropped
Sent:   13973 packets/sec, 1173.5K bytes/sec
Rcvd:   13973 packets/sec, 1173.5K bytes/sec
zorkmid# spray -d 1 localhost
sending 1162 packets of lnth 86 to localhost ...
        in 23.24 seconds elapsed time
        no packets dropped
Sent:   50 packets/sec, 4.2K bytes/sec
Rcvd:   50 packets/sec, 4.2K bytes/sec
zorkmid# spray -d 2 localhost
sending 1162 packets of lnth 86 to localhost ...
        in 23.24 seconds elapsed time
        no packets dropped
Sent:   50 packets/sec, 4.2K bytes/sec
Rcvd:   50 packets/sec, 4.2K bytes/sec


>Fix:
	
spray -d uses usleep(3).  Perhaps it should also be able to nanosleep(2),
or it should probabilistically sleep on some packets, and not others, or
sleep at Possion intervals between packets.

--jhawk
>Release-Note:
>Audit-Trail:
>Unformatted: