Wednesday, February 1, 2012

OSError: [Errno 38] Function not implemented

Server: Ubuntu 11.04

Run celeryd with info log level

$ ./manage.py celeryd -l info
[2012-02-01 01:16:45,779: ERROR/MainProcess] Unrecoverable error: OSError(38, 'Function not implemented')
Traceback (most recent call last):
  File "/var/www/th4x/.env/lib/python2.7/site-packages/celery/worker/__init__.py", line 268, in start
    component.start()
  File "/var/www/th4x/.env/lib/python2.7/site-packages/celery/concurrency/base.py", line 72, in start
    self.on_start()
  File "/var/www/th4x/.env/lib/python2.7/site-packages/celery/concurrency/processes/__init__.py", line 43, in on_start
    self._pool = self.Pool(processes=self.limit, **self.options)
  File "/var/www/th4x/.env/lib/python2.7/site-packages/celery/concurrency/processes/pool.py", line 520, in __init__
    self._setup_queues()
  File "/var/www/th4x/.env/lib/python2.7/site-packages/celery/concurrency/processes/pool.py", line 695, in _setup_queues
    self._inqueue = SimpleQueue()
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 354, in __init__
    self._rlock = Lock()
  File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 147, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1)
  File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 75, in __init__
    sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 38] Function not implemented
[2012-02-01 01:16:45,780: INFO/MainProcess] process shutting down

Python's _multithreading requires /dev/shm to work. In Ubuntu /dev/shm points to /run/shm by default. Rename (or delete, I doubt it is necessary anymore) existing /dev/shm.

Create /dev/shm directory
$ sudo -i  # get root
$ mkdir /dev/shm

Add to /etc/fstab mounting of /dev/shm command
tmpfs /dev/shm    tmpfs   defaults,noexec,nosuid     0     0

Mount all unmounted filesystems from /etc/fstab.
$ mount -a
There should be no errors.

Run again
$ ./manage.py celeryd -l info

It starts normally.

1 comment:

Note: Only a member of this blog may post a comment.