kern/126289: select() apparently consumes cpu when it should not

Jakub Jasinski jakub.jasinski at utoronto.ca
Tue Aug 5 23:50:02 UTC 2008


>Number:         126289
>Category:       kern
>Synopsis:       select() apparently consumes cpu when it should not
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 05 23:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Jakub Jasinski
>Release:        7.0
>Organization:
>Environment:
FreeBSD mail2.parkin.ca 7.0-RELEASE FreeBSD 7.0-RELEASE #4: Tue Aug  5 19:09:47 EDT 2008     admin at mail2.parkin.ca:/usr/obj/usr/src/sys/CUSTOM  amd64
>Description:
Refer to http://www.freebsd.org/cgi/query-pr.cgi?pr=126230

select() consumes cpu when it should not.
>How-To-Repeat:
Run the sample select program (or any other program that select-s) while rsync-ing and a.out will consume >1% cpu:

#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>

int
main(void)
{
fd_set rfds;
struct timeval tv;
int retval;

FD_ZERO(&rfds);
FD_SET(0, &rfds);
tv.tv_sec = 120;
tv.tv_usec = 0;

retval = select(1, &rfds, NULL, NULL, &tv);

if (retval == -1)
perror("select()");
else if (retval)
printf("Data is available now.\n");
else
printf("No data within 120 seconds.\n");

return 0;
}

>Fix:


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


More information about the freebsd-bugs mailing list