Description
OSError: [Errno 38] Function not implemented. I started seeing this error after upgrading to python3.9. The reason is opensearch bulk
function is using multiprocessing module internally and python multiprocessing.pool.ThreadPool
is breaking.
OSError: [Errno 38] Function not implemented
sl = self._semlock = _multiprocessing.SemLock(
SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
File "/var/lang/lib/python3.9/multiprocessing/synchronize.py", line 57, in __init__
SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
File "/var/lang/lib/python3.9/multiprocessing/synchronize.py", line 162, in __init__
return Lock(ctx=self.get_context())
--
It looks like:
-
synchronize.Lock doesn't work in lambda for any version of Python (lambda has no /dev/shm, and no write access to /dev in lambda - see: https://aws.amazon.com/blogs/compute/parallel-processing-in-python-with-aws-lambda
) -
ThreadPool is now using synchronize.Lock from version 3.9
To Reproduce
Steps to reproduce the behavior:
- Deploy an application using
opensearch-py==1.0.0
to aws lambda - Invoke bulk function of opensearch
- See error
Expected behavior
The opensearch client should work as it was working fine with python3.6
Plugins
opensearch-py==1.0.0
Host/Environment (please complete the following information):
- OS: Aws lambda
Additional context
Add any other context about the problem here.