On 1/19/21 1:40 PM, Martin Simmons wrote:
> In theory jobs running without batch insert share a single BDB object in
> memory, but it is used with a lock by a per-job thread (which is why the db
> library has to be thread-safe).  See setup_job().
> 
> I say "in theory" because it looks like Bacula 9.6.4 broke this!


Aaaaaaah!  *THAT* would explain a lot.  9.6.4 is *EXACTLY* when I began
seeing problems.


> What is the output of "show catalog" in bconsole?  My guess is that you will
> see db_driver=MySQ i.e. missing the final "L" of MySQL.  This will prevent it
> from reusing the BDB object, leading to unexpected concurrency.


You are precisely correct.


*show catalog
Catalog: name=Catalog address=10.24.32.15 DBport=3306 db_name=bacula
      db_driver=MySQ db_user=bacula MutliDBConn=0
You have messages.


> 
> The bug is caused by this change:
> 
> diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c
> index fdb1d97bf9..11c4406ea7 100644
> --- a/bacula/src/dird/dird.c
> +++ b/bacula/src/dird/dird.c
> @@ -1265,7 +1265,7 @@ static bool check_catalog(cat_op mode)
>             /* To copy dbdriver field into "CAT" catalog resource class 
> (local)
>              * from dbdriver in "BDB" catalog DB Interface class (global)
>              */
> -            strncpy(catalog->db_driver, BDB_db_driver, db_driver_len);
> +            bstrncpy(catalog->db_driver, BDB_db_driver, db_driver_len);
>           }
>        }
> 
> which was part of 9.6.4.
> 
> To fix it, replace db_driver_len with db_driver_len+1 in this call to
> bstrncpy.  This has been fixed in Bacula 11 because the seemingly minor
> problem with "status catalog" was reported in
> https://bugs.bacula.org/view.php?id=2551 but it looks like the significance of
> it wasn't realized.


Thank you for tracking this down.  I would not have found that, I don't
understand the code well enough.


-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to