> I think we need to move
> num_workers++ to just before the pthread_create, and decrement it if
the
> pthread_create fails. I'll try that now...
> 

This patch against the current svn resolves the problem for me:

Index: jobq.c
===================================================================
--- jobq.c      (revision 8838)
+++ jobq.c      (working copy)
@@ -358,8 +358,10 @@
       Dmsg0(2300, "Create worker thread\n");
       /* No idle threads so create a new one */
       set_thread_concurrency(jq->max_workers + 1);
+      jq->num_workers++;
       if ((stat = pthread_create(&id, &jq->attr, jobq_server, (void
*)jq)) != 0) {
          berrno be;
+         jq->num_workers--;
          Jmsg1(NULL, M_ERROR, 0, _("pthread_create: ERR=%s\n"),
be.bstrerror(stat));
          return stat;
       }
@@ -386,7 +388,6 @@
    set_jcr_in_tsd(INVALID_JCR);
    Dmsg0(2300, "Start jobq_server\n");
    P(jq->mutex);
-   jq->num_workers++;

    for (;;) {
       struct timeval tv;

Kern: I can commit this if it's okay with you?

James

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to