giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.65k stars 267 forks source link

OSError: [Errno 38] Function not implemented #496

Closed oerp-odoo closed 5 years ago

oerp-odoo commented 5 years ago

I encountered an issue with pyftpdlib when it is being used on Ubuntu 18.04 (it works fine with Ubuntu 16.04).

Doing this:

from pyftpdlib.servers import FTPServer

Throws this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/odoo/.local/lib/python3.6/site-packages/pyftpdlib/servers.py", line 520, in <module>
    class MultiprocessFTPServer(_SpawnerBase):
  File "/home/odoo/.local/lib/python3.6/site-packages/pyftpdlib/servers.py", line 524, in MultiprocessFTPServer
    _lock = multiprocessing.Lock()
  File "/usr/lib/python3.6/multiprocessing/context.py", line 67, in Lock
    return Lock(ctx=self.get_context())
  File "/usr/lib/python3.6/multiprocessing/synchronize.py", line 162, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
  File "/usr/lib/python3.6/multiprocessing/synchronize.py", line 59, in __init__
    unlink_now)
OSError: [Errno 38] Function not implemented

Linux:

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic

Python 3.6.7 pyftpdlib 1.5.4

lurch commented 5 years ago

Looks similar to https://github.com/tqdm/tqdm/issues/466 and https://bugzilla.redhat.com/show_bug.cgi?id=1511200 and https://bugs.python.org/issue26924 ?

oerp-odoo commented 5 years ago

Apparently it seems it is related with multiprocessing and Lock. Gives same error, doing:

import multiprocessing
multiprocessing.Lock()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/multiprocessing/context.py", line 67, in Lock
    return Lock(ctx=self.get_context())
  File "/usr/lib/python3.6/multiprocessing/synchronize.py", line 162, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
  File "/usr/lib/python3.6/multiprocessing/synchronize.py", line 59, in __init__
    unlink_now)
OSError: [Errno 38] Function not implemented
giampaolo commented 5 years ago

Wow! That's weird. I fixed it in 004b975. Please confirm it works and I'll make a new release tomorrow.

oerp-odoo commented 5 years ago

@giampaolo I tested on our CI environment (where issue occurred) and I can confirm it does not raise an exception anymore (and unittests that use pyftpdlib also pass)