Re: [libopendkim] dkim_init() and dkim_close() thread problems

From: Dino Ciuffetti <dino_at_tuxweb.it>
Date: Fri, 30 Apr 2010 15:54:34 +0200 (CEST)

>> I have a crash problem calling dkim_init(NULL, NULL) and dkim_close()
>> into pthreads. Do I have to protect dkim_init(NULL, NULL) and
>> dkim_close() calls with a mutex lock into a multi threaded
>> implementation?

...
> dkim_close() should only be called as your program is exiting (or at least
> not using libopendkim anymore), and all it does is undo what dkim_init()
> did. Ideally there should be no other threads using the library at that
> point so I don't know how you might have a concurrency issue there.
>
> Do you have a stack trace that shows the problem?

Hi, I was offline for a couple of days, sorry...

Since libopendkim stuff in my program is executed from inside dlopen()ed
modules working into a (p)thread pool, the quickest way I found was to
call dkim_init() and dkim_close() with a static buffer, from each thread
function from inside each program module that have to work with DKIM. But
I found that doing so will cause my program to crash when the same funcion
get called in parallel. Once I protected those library calls with a mutex
the problem was never caught again, and my program (DKIM verify
mailfilter) is running stable under load for 4 days now.

Sorry for the stupid question, but how can I get a stack trace? gdb?

Ciao, Dino.

-- 
Dino Ciuffetti
Linux System Administrator and Architect
TuxWeb S.r.l. - http://www.tuxweb.it/
Received on Fri Apr 30 2010 - 13:54:49 PST

This archive was generated by hypermail 2.3.0 : Mon Oct 29 2012 - 23:19:47 PST