Robert T. McGibbon
Robert T. McGibbon

Reputation: 5277

'No Space Left on Device' when creating Semaphore?

I have recently started observing the following error with Python on a Macbook Pro (OS X 10.10). According to the disk utility, about one half of the 120 GB SSD drive remains available, so I suspect this is related not do disk but to some other filesystem property?

What factors control the amount of space available for semaphores? What can I do to fix this problem?

$ python -c 'import multiprocessing; multiprocessing.Semaphore()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/multiprocessing/context.py", line 81, in Semaphore
    return Semaphore(value, ctx=self.get_context())
  File "/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/multiprocessing/synchronize.py", line 127, in __init__
    SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx)
  File "/Users/rmcgibbo/miniconda/envs/3.4.2/lib/python3.4/multiprocessing/synchronize.py", line 60, in __init__
    unlink_now)
OSError: [Errno 28] No space left on device

(Note, this doesn't appear to depend on the version of python. Same error with 2.7.9)

Upvotes: 4

Views: 3480

Answers (2)

artemisian
artemisian

Reputation: 3106

Old post but for me the culprit was the tmpfs partition /dev/shm which was full.

Solution: increase its size (https://www.golinuxcloud.com/change-tmpfs-partition-size-redhat-linux/) or release some space.

Upvotes: 2

According to MacOSX manuals, the sem_open system call used to create a semaphore can fail with ENOSPC:

 [ENOSPC]           O_CREAT is specified, the file does not exist, and
                    there is insufficient space available to create the
                    semaphore.

I suggest you use dtruss to find out where Python tries to create this semaphore.

Upvotes: 3

Related Questions