Re: glib memory allocation problems



On Tue, 15 May 2007, Miklos Szeredi wrote:

On Fri, 11 May 2007 13:55:25 +0200 (CEST)

seems you managed to crash around the slice debugger doing realloc().
more interesting than the backtrace should actually be the
program output.
if you saw something like:
   GSlice: MemChecker: attempt to release block with invalid size...
then you actually have something to fix.
if not, i suspect you have a bad memory corruption somewhere, e.g.
where you're writing into already released memory regoins.
that can cause crashes pretty much everywhere.

OK, found the problem: g_thread_init() wasn't called by sshfs, and
hence the thread private data used by gslice wasn't actually thread
private.

Now I see that the mandatory use of g_thread_init() is documented, but
it's very non-obvious without reading the docs.  And there are no
apparent problems if it's not called.  Sshfs got away with it for a
long time even though people do stress it pretty heavily.

So the question is, should glib not make some sanity checking for code
that is not actually thread related (like gslice).

it does do sanity checking, it throws a big bold warning if you call
thread_init and gslice in the wrong order:
  http://blogs.gnome.org/view/timj/2007/01/02/0
  http://bugzilla.gnome.org/show_bug.cgi?id=331853


Dimitrios, there's a patch attached that should fix the crashes.

Thanks,
Miklos

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]