Hello James, I'll think about this some more and look at the code a bit then get back to you, but see below for my off the cuff thoughts ...
On Monday 27 April 2009 12:23:38 James Harper wrote: > Kern, > > I have just established that having the Exchange plugin enabled (but not > actually backing anything up itself) causes the cancel operation to fail > and flood bacula with "filed/backup.c:1048 Network send error to SD. > ERR=No error" messages. > > Currently, my code does this when it gets an event that I haven't > explicitly catered for: > > default: > _JobMessage(M_ERROR, "unknown event=%d\n", event->eventType); > break; > } > bfuncs->getBaculaValue(ctx, bVarFDName, (void *)&name); > return bRC_OK; > > so there are two possible issues - one is that I send a M_ERROR message, > and the other is that I don't actually do anything else. I think the best tactic is either to handle all events or ignore unknown ones. I think it is probably better to handle all of them, which is quite easy to do by simply removing the default clause, then the compiler will generate a warning message if there are any events that are not handled. Obviously you will probably want to ignore events that are not interesting to you. I expect in the future there will be more events added. > > The debug log from the point of the cancel onwards looks like: > > " > exchtest-fd: /usr/local/src/bacula/bacula/src/filed/job.c:251-0 > Executing cancel command. > exchtest-fd: /usr/local/src/bacula/bacula/src/filed/fd_plugins.c:133-0 > plugin_ctx=f90628 JobId=2282 > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/message.c:1095-0 Enter > Jmsg type=4 > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/message.c:613-0 Enter > dispatch_msg type=4 msg=exchtest-fd JobId 2282: Error: unknown event=13 > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/message.c:785-0 > DIRECTOR for following msg: exchtest-fd JobId 2282: Error: unknown > event=13 > exchtest-fd: /usr/local/src/bacula/bacula/src/filed/fd_plugins.c:852-0 > Bacula: return my_name=exchtest-fd > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/jcr.c:818-0 > set_jcr_job_status(exchtest.2009-04-27_19.56.14_25, A) > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/jcr.c:828-0 jid=2282 > OnEntry JobStatus=R set=A > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/jcr.c:835-0 jid=2282 > leave set_old_job_status=R new_set=A > exchtest-fd: > /usr/local/src/bacula/bacula/src/win32/compat/compat.cpp:910-2282 > sizino=8 ino=0 file=C:/Windows/system32/drivers/nmnt.sys > exchtest-fd: > /usr/local/src/bacula/bacula/src/findlib/find_one.c:328-2282 File ----: > C:/Windows/system32/drivers/nmnt.sys > exchtest-fd: /usr/local/src/bacula/bacula/src/filed/backup.c:1142-2282 > No strip for C:/Windows/system32/drivers/nmnt.sys > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/htable.c:142-2282 > Leave hash_index hash=0x663e93df index=48 > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/htable.c:306-2282 > lookup return 14e1f54 > exchtest-fd: /usr/local/src/bacula/bacula/src/filed/accurate.c:81-2282 > lookup <C:/Windows/system32/drivers/nmnt.sys> ok > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/htable.c:142-2282 > Leave hash_index hash=0x663e93df index=48 > exchtest-fd: /usr/local/src/bacula/bacula/src/lib/htable.c:306-2282 > lookup return 14e1f54 > exchtest-fd: > /usr/local/src/bacula/bacula/src/findlib/find_one.c:391-2282 > Non-directory incremental: C:/Windows/system32/drivers/nmnt.sys > " > > So the bacula-fd code itself keeps going, oblivious to the cancel. Hmm. That is strange. What it does is set a flag, then periodically at an appropriate point, it should check to see if the job is cancelled and stop the job. I suspect that I forgot to put a check in the plugin code -- will check. > > Am I doing something wrong in the way I handle the cancel? It looks to > me like bacula-fd itself is not behaving correctly but maybe my plugin > is the cause? Ideally, but not absolutely required, when the event occurs, you will set a flag then if called there after, you should simply return an error -- except for places where it asks you to cleanup the job or unload, ... Regards, Kern ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign 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
