]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix deadlock detection to work in daemon mode
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 23 Oct 2009 17:02:05 +0000 (19:02 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Sat, 24 Oct 2009 10:00:06 +0000 (12:00 +0200)
bacula/src/dird/dird.c
bacula/src/filed/filed.c
bacula/src/lib/signal.c
bacula/src/stored/bextract.c
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/stored.c
bacula/src/tools/bbatch.c
regress/tests/messages-test

index 86e73503a90dffe0861f87662d7df19f637ef439..3975d50b41d5accf53eb05c279e3dfe88942f7db 100644 (file)
@@ -261,13 +261,19 @@ int main (int argc, char *argv[])
       if (background) {
          daemon_start();
          init_stack_dump();              /* grab new pid */
-      }
-   
+      }   
       /* Create pid must come after we are a daemon -- so we have our final pid */
-      create_pid_file(director->pid_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
-      read_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+      create_pid_file(director->pid_directory, "bacula-dir", 
+                      get_first_port_host_order(director->DIRaddrs));
+      read_state_file(director->working_directory, "bacula-dir",
+                      get_first_port_host_order(director->DIRaddrs));
    }
 
+   set_jcr_in_tsd(INVALID_JCR);
+   set_thread_concurrency(director->MaxConcurrentJobs * 2 +
+                          4 /* UA */ + 5 /* sched+watchdog+jobsvr+misc */);
+   lmgr_init_thread(); /* initialize the lockmanager stack */
+
    load_dir_plugins(director->plugin_directory);
 
    drop(uid, gid, false);                    /* reduce privileges if requested */
@@ -310,10 +316,6 @@ int main (int argc, char *argv[])
    init_python_interpreter(&python_args);
 #endif /* HAVE_PYTHON */
 
-   set_jcr_in_tsd(INVALID_JCR);
-   set_thread_concurrency(director->MaxConcurrentJobs * 2 +
-      4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */);
-
    Dmsg0(200, "Start UA server\n");
    start_UA_server(director->DIRaddrs);
 
index a8ee0b216302104e144b9309e4023a34ded164a4..aa4ea35ace92c9a63a8c4917a2308dbd751a0aa3 100644 (file)
@@ -231,9 +231,14 @@ int main (int argc, char *argv[])
       init_stack_dump();              /* set new pid */
    }
 
+   set_thread_concurrency(me->MaxConcurrentJobs + 10);
+   lmgr_init_thread(); /* initialize the lockmanager stack */
+
    /* Maximum 1 daemon at a time */
-   create_pid_file(me->pid_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
-   read_state_file(me->working_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
+   create_pid_file(me->pid_directory, "bacula-fd",
+                   get_first_port_host_order(me->FDaddrs));
+   read_state_file(me->working_directory, "bacula-fd",
+                   get_first_port_host_order(me->FDaddrs));
 
    load_fd_plugins(me->plugin_directory);
 
@@ -255,8 +260,6 @@ int main (int argc, char *argv[])
    init_python_interpreter(&python_args);
 #endif /* HAVE_PYTHON */
 
-   set_thread_concurrency(10);
-
    if (!no_signals) {
       start_watchdog();               /* start watchdog thread */
       init_jcr_subsystem();           /* start JCR watchdogs etc. */
index e51010b08d09741bc84c5fdd2d45e66a31886610..94500d8e0608855f6883bed8155b0ee59bfe370e 100644 (file)
@@ -232,7 +232,6 @@ extern "C" void signal_handler(int sig)
 void init_stack_dump(void)
 {
    main_pid = getpid();               /* save main thread's pid */
-   lmgr_init_thread();                /* initialize the lockmanager stack */
 }
 
 /*
index b96f7dfd663117bfdc22f0b864edb87427105293..71c9da6bcb7c5484d33f2989be228e0740dddb96 100644 (file)
@@ -105,6 +105,7 @@ int main (int argc, char *argv[])
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
    init_stack_dump();
+   lmgr_init_thread();
 
    working_directory = "/tmp";
    my_name_is(argc, argv, "bextract");
index d8149750af8d0b3fd204c86503dd6b9244c4e4e9..c7158c9b6b4026ea0344573cfaf6877189c07ee8 100644 (file)
@@ -110,6 +110,7 @@ int main (int argc, char *argv[])
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
    init_stack_dump();
+   lmgr_init_thread();
 
    working_directory = "/tmp";
    my_name_is(argc, argv, "bls");
index fb04bc4c69eed6fe6ad357337856387e84b8b01d..113915f5720508e184237b68d56af074069e69a0 100644 (file)
@@ -150,6 +150,7 @@ int main (int argc, char *argv[])
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
    init_stack_dump();
+   lmgr_init_thread();
 
    my_name_is(argc, argv, "bscan");
    init_msg(NULL, NULL);
index 3ee885bad8a3e78e9eea4990154ad2fc11fb2119..8c0bd6f41667cae754d1a67bb8ff5a5acbe49178 100644 (file)
@@ -256,8 +256,14 @@ int main (int argc, char *argv[])
       init_stack_dump();              /* pick up new pid */
    }
 
-   create_pid_file(me->pid_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs));
-   read_state_file(me->working_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs));
+   create_pid_file(me->pid_directory, "bacula-sd",
+                   get_first_port_host_order(me->sdaddrs));
+   read_state_file(me->working_directory, "bacula-sd", 
+                   get_first_port_host_order(me->sdaddrs));
+
+   /* Make sure on Solaris we can run concurrent, watch dog + servers + misc */
+   set_thread_concurrency(me->max_concurrent_jobs * 2 + 4);
+   lmgr_init_thread(); /* initialize the lockmanager stack */
 
    load_sd_plugins(me->plugin_directory);
 
@@ -286,9 +292,6 @@ int main (int argc, char *argv[])
    init_python_interpreter(&python_args);
 #endif /* HAVE_PYTHON */
 
-   /* Make sure on Solaris we can run concurrent, watch dog + servers + misc */
-   set_thread_concurrency(me->max_concurrent_jobs * 2 + 4);
-
     /*
      * Start the device allocation thread
      */
index 286b908596c3879ab1e8918e53ca4839414ebcd7..46bc909c074a6504aead7056e7e1831e02b0411c 100644 (file)
@@ -103,6 +103,7 @@ int main (int argc, char *argv[])
    bindtextdomain("bacula", LOCALEDIR);
    textdomain("bacula");
    init_stack_dump();
+   lmgr_init_thread();
    
    char **files = (char **) malloc (10 * sizeof(char *));
    int i;
index 918943805f3f8c6f3ad4d6610f43af43a8261077..a8456a79a8668abf94f3d880707af3d5301175c7 100755 (executable)
@@ -33,7 +33,7 @@ cat <<END_OF_DATA >$tmp/bconcmds
 @$out /dev/null
 messages
 @$out $tmp/log1.out
-setdebug level=100 storage=File
+@#setdebug level=100 storage=File
 label volume=TestVolume001 storage=File pool=File
 run job=$JobName yes
 @sleep 1