From: <bac...@li...> - 2005-12-21 13:43:02
|
The following bug has been CLOSED ====================================================================== http://bugs.bacula.org/bug_view_advanced_page.php?bug_id=0000500 ====================================================================== Reported By: kc0 Assigned To: ====================================================================== Project: bacula Bug ID: 500 Category: Win32 File Daemon (client) Reproducibility: always Severity: crash Priority: normal Status: closed ====================================================================== Date Submitted: 11-29-2005 11:20 PST Last Modified: 12-21-2005 05:42 PST ====================================================================== Summary: win32 bacula-fd crashes during exit (state file problem?) Description: After installing bacula, running bacula-fd for the first time works great. But after closing bacula (using the tray icon), bacula-fd crashes. The trace says: status.c: 489 End bac_status jcr loop. (so far so good) Bacula state <one line of binary stuff> Bacula state <one line more of binary stuff> Not sure what this means. Anyway, when I try to start bacula again, it crashes instantanious with the message: Program: C:\bacula\bin\bacula-fd.exe File: write.c Line: 72 Expression: (_osfile(fh) & FOPEN) The last line of the trace file now says: bsys.c:503 Could not read state file. sdf=3 stat=0 size=192: Err=No error Looks like it has something to do with a "state" file? The used bacula-fd.conf contains: WorkingDirectory = c:/bacula/working A bacula-fd.9102.state file (0 bytes) is left in c:/bacula/working after the crash. When I remove this file before starting bacula again, bacula starts correctly. But the same error occurs whenever I shut down bacula. The 'delete the state file before starting bacula' is a nice workaround, but I'd like to know what the cause is so we can fix it. Any ideas? Cheers, Kees ====================================================================== ---------------------------------------------------------------------- kc0 - 12-05-2005 03:14 PST ---------------------------------------------------------------------- Now I've got the debugger in VC++ 2005 working with bacula-fd, this is the problematic code: file: bsys.c in procedure: void write_state_file(char *dir, const char *progname, int port) input: dir = "c:/tmp", progname = "bacula-fd", port = 9102 call: sfd = open(fname, O_CREAT|O_WRONLY|O_BINARY, 0640) input: fname = "c:/tmp/bacula-fd.9102.state" output: sfd = 3(int) The open call is defined in compat.cpp on line 1571. As far as I can see, it works fine. call: write(sfd, &state_hdr, sizeof(state_hdr)) input: sfd = 3(int), input: state_hdr = {id=0x00553100 "Bacula State" version=3 last_jobs_addr=0 ...} The debugger won't show code of the write call (as it does with the open call), so I guess 'write' is from a standard library. Because bacula-fd reports an error during this call, maybe this 'write' should also be defined in compat.cpp? Because I have HAVE_VC8 defined, the 'write' functions defined in compat.cpp are excluded. Anyone can give me a hint where to look next? ---------------------------------------------------------------------- kc0 - 12-05-2005 11:04 PST ---------------------------------------------------------------------- As a workaround to keep bacula-fd from crashing. comment line 251 of filed.c: write_state_file(...); (Not sure what's the effect of not saving the state file) ---------------------------------------------------------------------- kern - 12-10-2005 12:40 PST ---------------------------------------------------------------------- Does the released version of Bacula (on Source Forge) do the same thing? I ask because the error you are describing doesn't make happen with the code that I am currently using (VC++ 2003). That said, there is something messed up with the state file on Win32 systems because it is never written correctly on exit. I can imagine your problem only if there is a bug in the Microsoft VC++ 2005 runtime compatibility (POSIX) library. ---------------------------------------------------------------------- kern - 12-21-2005 05:42 PST ---------------------------------------------------------------------- You did a nice analysis ... Fixed in version 1.38.3 (21 December 2005) to be released this afternoon. It looks like it was not calling the compat write() routine ... After looking at this in more detail, it had nothing to do with your Windows 2005 libraries (well, they may still be broken, but that is not what broke this). Bug History Date Modified Username Field Change ====================================================================== 11-29-05 11:20 kc0 New Bug 12-02-05 09:29 kern summary bacula-fd crashes during exit (state file problem?) => win32 bacula-fd crashes during exit (state file problem?) 12-05-05 03:14 kc0 Bugnote Added: 0001359 12-05-05 11:04 kc0 Bugnote Added: 0001360 12-10-05 12:40 kern Bugnote Added: 0001370 12-10-05 12:40 kern Status new => feedback 12-21-05 05:42 kern Bugnote Added: 0001406 12-21-05 05:42 kern Resolution open => fixed 12-21-05 05:42 kern Status feedback => closed ====================================================================== |