Closing database in exit handler
David Relson
relson at osagesoftware.com
Sun Sep 11 14:52:33 CEST 2005
On Sun, 11 Sep 2005 09:36:58 +0200
Stefan Bellon wrote:
> On RISC OS, file handles are not automatically closed by the operating
> system when a process dies (yes, this is annoying but cannot be
> changed). So, if a process crashes and had file handles open at that
> time, they remain open and the user has to close them manually.
>
> When Bogofilter crashes (rarely the case, but happens from time to
> time), it leaves wordlist.db open. I have no idea where in the code the
> exact places are, but those in the know, couldn't they just add
> something like
>
> open_database();
> atexit(close_database);
>
> i.e. register an exit handler when the database got opened?
>
> For all but the hardest kind of crashes, this helps on RISC OS.
>
> --
> Stefan Bellon
Hi Stefan,
We used to have atexit(bf_exit) code for cleanup. With the addition of
transactions last year, it was no longer necessary and was removed.
Since it seems to be needed again, I've resurrected the code and it's
now in cvs.
By the way, are any of your crashes reproducible, hence fixable?
Regards,
David
More information about the bogofilter-dev
mailing list