[Monetdb-developers] locate_file and error handling

Mark Bucciarelli mkbucc at gmail.com
Wed Mar 17 14:06:12 CET 2010


As I read the source, I see lots of instances
where return values are not checked or not
handled; for example, strdup().

Most recently, this programming idiom triggered
a null pointer dereference, which caused mserver
to segfault (see tracker #2971516 [1]).

In my experience, when the logic encounters a
condition it can't recover from, exiting quickly with
as much information as possible is very useful.

Whe I read locate_file() method and see:

   char *mod_path = GDKgetenv("monet_mod_path");
   if (mod_path == NULL)
        return NULL;

I wonder---how can you recover from this?  I want to
submit a patch that says:

   if (mod_path == NULL)
        errx(1, "locate_file: GDBgetenv("monet_mod_path") is null");

But I'm not sure you guys will accept this.  Would you?
It's a large change to error handling style.

What happens to me in #2971516 is simply the library file
name is not found.  But instead of a useful error message
that tells me what directories where searched and what
the file name is, I get

ERR control[14875]: (local): failed to fork mserver:
   database 'test' has inconsistent state (running
   but dead), review merovingian's logfile for any

and an mserver5.core file.



[1] https://sourceforge.net/tracker/index.php?func=detail&aid=2971516&group_id=56967&atid=482468

More information about the developers-list mailing list