NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45187: select(2) sometimes doesn't wakeup



>Number:         45187
>Category:       kern
>Synopsis:       select(2) sometimes doesn't wakeup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 28 16:15:01 +0000 2011
>Originator:     Manuel Bouyer
>Release:        NetBSD 5.99.55
>Organization:
>Environment:
System: NetBSD borneo 5.99.55 NetBSD 5.99.55 (GENERIC) #2: Thu Jul 28 17:49:53 
CEST 2011  
bouyer@hop:/dsk/l1/misc/bouyer/tmp/amd64/obj/dsk/l1/misc/bouyer/quota2/src/sys/arch/amd64/compile/GENERIC
 amd64
Architecture: amd64
Machine: amd64
>Description:
        While testing a fix for another issue, I ran the following:
while (1)
rsync -avH --delete --delete-excluded --delete-after --delay-updates --force 
--stats --partial rsync://rsync.fr.netbsd.org/NetBSD/NetBSD-release-5-0/src .
rsync -avH --delete --delete-excluded --delete-after --delay-updates --force 
--stats --partial rsync://rsync.fr.netbsd.org/NetBSD/NetBSD-release-4-0/src .
end

        Then I noticed that rsync would be very slow, updating only a few
        files per minutes (the test box has a 100Mb connection to
        rsync.fr.netbsd.org). It spends most of its time in select(2),
        while the receive socket buffer is full.
        ktrace shows the following:
   4102      1 rsync    1311780519.324063908 CALL  
select(4,0x7f7fffff83b0,0x7f7fffff8390,0,0x7f7fffff83d0)
   4102      1 rsync    1311780579.483436279 RET   select 0
   4102      1 rsync    1311780579.483440327 CALL  
select(4,0x7f7fffff83b0,0x7f7fffff8390,0,0x7f7fffff83d0)
   4102      1 rsync    1311780579.483442445 RET   select 1
   4102      1 rsync    1311780579.483443326 CALL  read(3,0x7f7ff7a36de2,0x21a) 
   4102      1 rsync    1311780579.483451341 GIO   fd 3 read 538 bytes

So select blocks (maybe because there's effectively nothing to read at this
time), but instead of waking up when there's data ready it wakes up
when the timeout expires. The next select call returns immediatly.

>How-To-Repeat:
        see above
>Fix:
        disabling DIRECT_SELECT in sys/kern/sys_select.c (with a
        #define NO_DIRECT_SELECT at top of file) makes rsync behaves
        as expected.



Home | Main Index | Thread Index | Old Index