On 3/25/25 14:35, Rob Gerber wrote:
Josh,

Here you go. Thank you!

*My Synology-Local autochanger and associated devices from bacula-sd.conf file:*
*
*
...

OK. That looks like the usual autochanger config.

Looking at the log of the jobs starting, note that:

*Joblogs from jobs 662 and 663 (copied directly out of bacula.log):*
20-Mar 23:05 td-bacula-dir JobId 662: Start Backup JobId 662, Job=Backup-win11-base-fd-job.2025-03-20_23.05.01_40
...

20-Mar 23:05 td-bacula-dir JobId 663: Start Backup JobId 663, Job=Backup-akita-job.2025-03-20_23.05.01_41


those jobs started simultaneously.

I believe it is a race condition. Each job, at startup, is assigned a device, in this case an autochanger drive. Then each job selects a volume to write on. The drive selection is handled atomically, and each volume selection is handled atomically, however, if two jobs start simultaneously, then one job wins and gets to select a volume first. So, after both jobs had selected a device, it went something like this:

- Both job 662 and 663 are in queue waiting to select a volume
- Job 662 wins and enters atomic volume selection. Since all volumes are used only once, it creates Synology-Local-Inc-250.
- Job 662 leaves atomic volume selection and job 663 enters.
- Job 663 now sees a new volume Synology-Local-Inc-250 ready to be written to and selects it - Job 662 mounts Synology-Local-Inc-250 in its device and changes the volume status to Used - Job 663 attempts to mount Synology-Local-Inc-250, but sees that it is Used, Logs the error, then re-enters atomic volume selection and creates Synology-Local-Inc-251

It happens seemingly randomly because it depends on the timing. Sometimes the first job already has the volume marked as used BEFORE the other job enters atomic volume selection, and then it works as expected.

The easy fix (to the code) is likely to do the volume status change before leaving the atomic volume selection whenever the max volume jobs count is reached.

The workaround is to give each job a different priority or else stagger the job start times in the Job definitions for each job. Of course, that is a pain if there are a lot of jobs.
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to