smbd holds 70% cpu

David Collier-Brown -- Customer Engineering David.Collier-Brown at Sun.COM
Thu Jul 31 13:36:23 GMT 2003


Nir Livni wrote:
>>int select(int  nfds,  fd_set  *readfds,  fd_set  *writefds,
>>       fd_set *errorfds, struct timeval *timeout);
>>
>>	Firstly, see how often it's happening, either by
>>	reading the contents of the timeval or just counting	
>>	seconds (;-))
>>
>>	Next llok at the return value: -1 for an error (check errno)
>>	0 for a timeout, and a non-zero number if at elast one
>>	fd reorted something.
>>
> 
> 
> Does this one look like a reasonable select ?
> select(1024, [29 30], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be
> restarted).

  	Ok, it's saying that FDs 29 and 30 have data,
	but it returned -1 and errno == ERESTARTNOHAND

	LSOF will tell you what 29 and 30 are, but
	the interesting thing is ERESTARTNOHAND...
	The standard says that legal errnos are
	EBADF, EINTR and EINVAL, and glibc adds ENOMEM.

	Looking at the code, the select calls are
C symbol: select

   File        Function   Line
1 types.h     <global>    94 #define select _abi_select
6 select.c    sys_select  94 ret =
                  select(maxfd,readfds2,writefds,errorfds,tval);
7 system.c    sys_usleep  71 select(0,NULL,NULL,NULL,&tval);
1 wb_common.c write_sock 200 if (select(winbindd_fd + 1, &r_fds,
                  NULL, NULL, &tv) == -1) {

	The likely (but not guaranteed) call is in sys_select,
	which passes a timeval of 0 instead of NULL...

	Ok, samba gurus, assuming this looping was in sys_select,
	what would happen if errno was set to something unexpected?

	And Linux gurus, what the heck is ERESTARTNOHAND? I
	can't find it in /usr/include... I did find ERESTART,
	which is standard...
	
--dave	
-- 
David Collier-Brown,           | Always do right. This will gratify
Sun Microsystems DCMO          | some people and astonish the rest.
Toronto, Ontario               |
(905) 415-2849 or x52849       | davecb at canada.sun.com





More information about the samba-technical mailing list