Hello, I've sort of narrowed the problem down and found a solution that doesn't seem to break in Linux. I found that the mutex causing the trouble was being initialized in nn_global_init through the call, nn_ctx_init. The function nn_global_term does not have a matching call to nn_ctx_term. I have forked on github, but haven't issued a pull request yet because two tests still fail on QNX. ipc_shutdown and tcp_shutdown. Cheers, Hajime 2014-05-12 10:15 GMT+09:00 Hajime Saito <emijah.s@xxxxxxxxx>: > Hello, > > I've added a > printf("nn_mutex_init: self->mutex = 0x%X\n", &self->mutex); > to nn_mutex_init and something equivalent to nn_mutex_term. > The output from inproc is as follows. > > bash-4.1# ./tests/inproc > sc test_socket - start > nn_mutex_init: self->mutex = 0xB8235838 > nn_mutex_init: self->mutex = 0xB8235660 > nn_mutex_init: self->mutex = 0xB82356C0 > nn_mutex_init: self->mutex = 0x8062DE8 > sc test_socket - end > sb test_socket - start > nn_mutex_init: self->mutex = 0x8060A30 > sb test_socket - end > sc test_close - start > nn_mutex_term: self->mutex = 0x8062DE8 > sc test_close - end > sb test_close - start > nn_mutex_term: self->mutex = 0x8060A30 > nn_mutex_term: self->mutex = 0xB8235660 > nn_mutex_term: self->mutex = 0xB8235838 > sb test_close - end > sb test_socket - start > nn_mutex_init: self->mutex = 0xB8235838 > nn_mutex_init: self->mutex = 0xB8235660 > nn_mutex_init: self->mutex = 0xB82356C0 > Resource busy [16] (src/utils/mutex.c:55) > abort (core dumped) > > I added printf before and after test_socket and test_close. > It does seem that there is one mutex that is being used without being > closed first. > > Hajime > > > 2014-05-09 19:17 GMT+09:00 Martin Sustrik <sustrik@xxxxxxxxxx>: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> On 09/05/14 11:41, Martin Sustrik wrote: >> >>> Is there anything special about QNX mutexes? Are they created in a >>> locked state or something like that? >> >> Actually, it's pthread_mutex_init() failing with EBUSY -- i.e. it >> claims that we are ri-initialising an open mutex. >> >> The best way to debug that would be to print out mutex's address in >> both nn_mutex_init() and nn_mutex_term() and then run one of the >> failing tests. >> >> We can then check whether nanomsg is actually trying to re-initialise >> an open mutex or whether it is just some QNX quirk. >> >> Martin >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.11 (GNU/Linux) >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> iQEcBAEBAgAGBQJTbKswAAoJENTpVjxCNN9YL3sH/jlXH1UYE9aPnWqyJ6hlNPzv >> 2uRuS/VNzUgldAS3uIIHk8P6cBYCXdiSXpI34JLrpvbfAY4KsKBK6bB9CVF4RTaY >> XL2XLhAJ6ZipKHZ/nD1HZDZJS4GKy02aDRaX0VYQPdNSFNR4hEUYEfZjzUBBlTxx >> BrONnHzTkgB+QsCt7zLck+S44OKxd4IKWcMpMk9PrFd2yKsPh7cKpHhcIGgly1as >> 71VV/Vd752tzUkMB3T0/6cmj+rNKOQy09mY6ENylCNyKsJj8hmsIcc1RZaIjh+bH >> VaFUn8lArbg9fvNrAD1YI0dR71ZL902RZSRe8f18lUtpaPPbIhH9hJctqtj41WM= >> =FOBF >> -----END PGP SIGNATURE----- >>