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

Re: [Libevent-users] [patch] more testcases



On Thu, Oct 20, 2011 at 06:52, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
> On Wed, Oct 19, 2011 at 9:58 AM, Leonid Evdokimov <leon@xxxxxxxxxxxx> wrote:
> (The style tweak is that I generally do
> Â"struct foo *bar;" rather than "struct foo* bar;"

Yep, I know that "*" applies to specific variable and not to the type,
that's just my habit, I'll try to keep that in mind for further
patches.


>> 0003 fires with current codebase but, seems, it should not.
> event_reinit is tricky and fragile code; I am sad but not shocked to
> see a bug there. ÂI tried poking at it a little bit with gdb to see
> where the failure was happening, but the bug seemed to evaporate when
> I added breakpoints: ouch. ÂI'll try to look more.

I used following script to get backtraces:

export LD_LIBRARY_PATH=$PWD/.libs
# main/fork_dbg
for i in dns/leak_cancel dns/leak_shutdown main/fork_dbg_st main/fork_dbg_mt; do
	i_name="`echo $i | tr / _`"
	{ gdb --quiet --batch \
		--ex 'set follow-fork-mode child' \
		--ex 'r' --ex 'bt' \
		--args ./test/.libs/regress $i
	sleep 1
	} &> bug/$i_name &
done
wait

And it constantly fails :)


> Have you tried running the test under valgrind? ÂIf there's really a
> double-unassign happening, it might notice something wrong.

Nope, I have not tried valgrind at first, but I run it right now and
it founds nothing besides some known leaks - my tests do not free all
the resources.

So it looks like bug in pinning/unpinning events to the self-debugging hashmap.

Be the way - maybe, all tests should be running in
event_enable_debug_mode() ? Or, maybe, twice - with the mode enabled
and disabled.
And, maybe, with counting malloc - it can be easily made thread-safe
using atomic variables[1].
What do you think regarding that?

[1] http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Atomic-Builtins.html

--
WBRBW, Leonid Evdokimov
xmpp:leon@xxxxxxxxxxxx && http://darkk.net.ru
tel:+79816800702 && tel:+79050965222
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.