Uploaded image for project: 'libzmq'
  1. libzmq
  2. LIBZMQ-281

Crash on heavy socket creation: Device or resource busy (mutex.hpp:91)


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      zeromq 2.1.9, 2.1.10
      FreeBSD 8.2, max-fds 11095
      CentOS 5.5 (2.6.18-194.11.4.el5), max-fds 1024


      On heavy socket creation I experience an assert hit when pthread_mutex_destroy is called in mutex.hpp.

      Attached is a piece of code which demonstrates this.
      Compiled with: gcc -O zmqtest.c -o zmqtest -lzmq -lpthread

      When tested on a Linux box:

      pong 18200
      Device or resource busy (mutex.hpp:91)
      zsh: abort (core dumped) ./zmqtest

      On repeated tests the counter have gone to anything from 9k to 70k before crashing. Crashing every time.

      On the FreeBSD box I have bit harder time to reproduce it, in some cases I get NULL from zmq_socket in the hammer threads instead (with errno 24: Too many open files). However, it is still reproducible, with counter going from anything to 80k to 200k before crashing.

      Note that the Too many open files problem never occurs on the Linux box, I always hit the assert before, even though the max-fd limit is much lower on the Linux box (see Env).

      This problem was noticed in a scenario where a local thread REQ'ed via inproc to a ROUTER thread and then closed the socket. When benchmarking and hammer-testing this code I found this problem. In my code I've solved this by keeping the socket in a thread-local container.




            • Assignee:
              pieterh Pieter Hintjens
              jstrom Johan Ström
            • Votes:
              1 Vote for this issue
              2 Start watching this issue


              • Created: