Antwort: Re: [Samba] 3.0.4: smbd's + nscd's = 100% CPU; load > 4

Dragan.Krnic at bahn.de Dragan.Krnic at bahn.de
Tue Jul 13 17:52:30 GMT 2004


>> Bingo! It is exactly the same case.
>> Two user names were spelled out slightly wrong
>> in the /etc/group. As a consequence,
>> under certain circumstances the "smbd" process
>> keeps trying to resolve the name and doesn't
>> take "no" from "nscd" for an answer.
>> Each "smbd" process is looping around
>> these 5 system calls:
>> 1) create a socket,
>> 2) connect to nscd's socket,
>> 3) write the mis-spelled name,
>> 4) read negative answer
>> 5) close socket:
>>
>>    socket(PF_UNIX,SOCK_STREAM,0)=26
>>    connect(26,{sa_family=AF_UNIX,path="/var/run/.nscd_socket"},110)=0
>>    writev(26,[{"\2\0...\0\22\0...",12},{"GeorgeDubbyaBusch\0",18}],2)=30
>>    read(26,"\2\0\0\...\0\377\377\377\377\377\377"...,36)=36
>>    close(26)=0
>>
>> and the nscds spin like this
>>
>>    poll({fd=3,events=POLLRDNORM,revents=POLLRDNORM}],1,-1)=1
>>    accept(3,,NULL)=9
>>    read(9,"\2\0\0\0\0\0\0\0\22\0\0\0",12)=12
>>    read(9,"GeorgeDubbyaBusch\0",18)=18
>>    write(9,"\2\0\...\0\377\377\377\377\377\377"...,36=36
>>    close(9)=0
>>
>> Since both mis-spelled names are among the
>> earliest user names in 2 most frequently used
>> groups (one is "users"), it's hard to tell
>> why the smbd processes spin out of control so
>> infrequently. Jeremy will know more about that.
>
> Ok, looking at the code in 3.0 there is no loop around the
> lookup for a bad user name. The code in question is here:
>
>     for (gr = grp->gr_mem; (*gr != NULL) && ((*gr)[0] != '\0'); gr += 1)
{
>           struct passwd *pw = getpwnam(*gr);
>
>           if (pw == NULL)
>                 continue;
>           add_uid_to_array_unique(pw->pw_uid, uids, num);
> }
>
> Note that if pw == NULL then the name should be skipped and
> the next entry examined. This code is not looping on bad lookups
> within smbd.
>
> Is it possible to attach to the smbd in question with gdb and
> walk through this code with a bad username in the group entry
> list and see if the getpwnam call ever returns NULL or just
> loops inside glibc ?

I checked my /etc/group for irregular entries and repaired
all of them. Since then the problem didn't occur any more.
Even so it wasn't very frequent.

I still have a bunch of strace logs of smbd and of nscd.
Cann I upload it somewhere for you if you can use it?

Or do you suggest to replant the erroneous entries and
wait for the loop ?

Cheers

---------

Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte
Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail sind nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.

----------




More information about the samba mailing list