winbindd go into infinity loop when disconnect connection with windows server. service unavailable after windows server back and cannot restart winbindd. busy loop was caused by circularly children list at folloing code: source3/winbindd/winbindd_dual.c: void winbind_child_died(pid_t pid) { struct winbindd_child *child; for (child = children; child != NULL; child = child->next) { if (child->pid == pid) { break; } } circularly list was make by DLIST_ADD(children, child) in fork_domain_child() When already added child in children, second operation will make circularly list. (see DLIST_ADD definition) Anyway, We need to avoid infinity loop.
Created attachment 7653 [details] patch for samba-3.5.15 patch for samba-3.5.15
Created attachment 7654 [details] patch for 3.5.15
Created attachment 7655 [details] patch for samba-3.5.15
Comment on attachment 7653 [details] patch for samba-3.5.15 >diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c >index 360f1b2..ebda52a 100644 >--- a/source3/winbindd/winbindd_dual.c >+++ b/source3/winbindd/winbindd_dual.c >@@ -1305,6 +1305,7 @@ static bool fork_domain_child(struct winbindd_child *child) > struct winbindd_request request; > struct winbindd_response response; > struct winbindd_domain *primary_domain = NULL; >+ struct winbindd_child *c; > > if (child->domain) { > DEBUG(10, ("fork_domain_child called for domain '%s'\n", >@@ -1336,8 +1337,18 @@ static bool fork_domain_child(struct winbindd_child *child) > /* Parent */ > close(fdpair[0]); > child->next = child->prev = NULL; >- DLIST_ADD(children, child); > child->sock = fdpair[1]; >+ /* >+ * We need to check duplicate element before >+ * DLIST_ADD. Otherwise, childlen list be circularly. >+ */ >+ for (c = children; c != NULL; c = c->next) { >+ if (c == child) { >+ DEBUG(5, ("Already added child in children\n")); >+ return True; >+ } >+ } >+ DLIST_ADD(children, child); > return True; > } >
Isn't this a duplicate of Bug 8409? I had thought that 3.5 is not affected by that, but I might have been wrong.
Yes! I'm sure the bug is duplicate of Bug 8409. We need to apply your patch to 3.5 too. and I hope anyone does not to write more "child->sock = -1"... Thank you.
Created attachment 7658 [details] Patch from bug 8409 ported to 3.5
Comment on attachment 7658 [details] Patch from bug 8409 ported to 3.5 ACK
==> Karo for inclusion into 3.5.next
Pushed to v3-5-test. Closing out bug report. Thanks!