Bug 4508 - blocking loop in winbind
blocking loop in winbind
Status: RESOLVED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: winbind
3.0.25
All All
: P3 regression
: 3.0.25
Assigned To: Gerald (Jerry) Carter
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-12 15:23 UTC by Simo Sorce
Modified: 2007-04-22 17:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simo Sorce 2007-04-12 15:23:18 UTC
When the idmap db is empty calling getpwnam leads to a cascade of calls that
deadlocks the main winbindd daemon.

This happens when winbindd_fill_pwent() exceuted in the parent process, directly
calls idmap_sid_to_uid() which may end up calling idmap_new_mapping() and finally
winbind_lookup_sid().
The winbind_lookup_sid() calls deadlocks as we are in the parent trying to communicate with the parent again.

The proper fix would be to make the getpw*/getgr* calls fully async, but workind on a quick workaround to avoid the deadlock without too much rewrite right now.
Comment 1 Simo Sorce 2007-04-12 16:10:44 UTC
ok fixed in revision 22204
was quicker than I thought.
Comment 2 Gerald (Jerry) Carter 2007-04-17 16:49:34 UTC
Samb abug in idmap_rid.  See mail msg here:
http://lists.samba.org/archive/samba-technical/2007-April/052875.html

From the email:  

During the 30 second pause, a stack trace of winbind shows:

# pstack `pgrep winbind`
6572:   ./sbin/winbindd -S -i -d 10
 fea80957 pollsys  (8043100, 1, 80431e8, 0)
 fea2ee0a pselect  (13, 8043220, feaa9868, feaa9868, 80431e8, 0) + 18e
 fea2f100 select   (13, 8043220, 0, 0, 80432a0) + 82
 08165c74 read_sock (8044008, ca8) + 104
 08165dc2 read_reply (8044008) + 52
 081660b2 winbindd_get_response (8044008) + 72
 08166195 winbindd_request_response (0, 8044cb0, 8044008) + 75
 08165890 winbind_open_pipe_sock (0, 0) + 140
 081659e3 write_sock (8046ae4, 824, 0, 0) + 43
 08165fb2 winbindd_send_request (14, 0, 8046ae4) + a2
 08166174 winbindd_request_response (14, 8046ae4, 8045e3c) + 54
 08163ad1 winbind_lookup_sid (83b3158, 804770c, 804734c, 8047348, 8047344) + a1
 fe4f11b2 idmap_rid_sid_to_id (83b3158, 83fa738, 804745c) + 72
 fe4f177c idmap_rid_sids_to_unixids (83fa590, 83b4960) + 11c
 082d2bd8 idmap_backends_sids_to_unixids (83fa858) + 5e8
 082d38c5 idmap_sids_to_unixids (8047454) + 4a5
 082d69cb idmap_sid_to_gid (804770c, 80474a8) + cb
 0808e358 winbindd_getgrnam (83fac38) + 5e8
Comment 3 Gerald (Jerry) Carter 2007-04-17 16:51:13 UTC
Simo's proposed fix is here:

http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&rev=22204
Comment 4 Gerald (Jerry) Carter 2007-04-22 17:47:16 UTC
Fixed for 3.0.25rc2 by ensuring the caller fills in the SID type.