Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Channel mutex cleanup when destroying host context #62

Closed
mkushnir opened this Issue Jan 21, 2016 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

mkushnir commented Jan 21, 2016

Valgrind (on FreeBSD) has shown a channel mutex hanging after a host context destroy. Below are snippets from valgrind output:

[...]
==70693== 80 bytes in 1 blocks are definitely lost in loss record 503 of 587
==70693==    at 0x4C24C90: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==70693==    by 0x64A86DB: pthread_mutex_init (in /lib/libthr.so.3)
==70693==    by 0x749A02F: __pmInitChannelLock (context.c:319)
==70693==    by 0x749A02F: pmNewContext (context.c:597)
==70693==    by 0x860164B: ???
==70693==    by 0x8601450: ???
==70693==    by 0x400CF3: test0 (testfoo.c:128)
==70693==    by 0x400B43: main (testfoo.c:152)
==70693== 

[...]

I'm attaching a suggested fix (including parts of #61 fix, please ignore it here).
out.txt

Contributor

kmcdonell commented Jan 21, 2016

Thanks Markiyan. I've applied your patch, and some cosmetic refactoring of the static function names in context.c in commit f995cc7 in my tree. Will flow upstream in due course.

@kmcdonell kmcdonell closed this Jan 21, 2016

natoscott pushed a commit that referenced this issue Jan 22, 2016

libpcp: add missing pthread_mutex_destroy calls for pc_lock (pmcd ipc…
… lock)

Original patch by Markiyan Kushnir <markiyan.kushnir@gmail.com>
to address #62.

Some refactroring to "downgrade" the name of the new static function
involved (and on reflection some of their peers in context.c) from
__pmFooBar() to foobar() as these symbols are not, and never will be,
visible at the library API (cosmetic and code readability issue).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment