[ERROR] OSError: [Errno 38] Function not implemented - Accessing trend deepsecurity.ComputersApi via Lambda
Resolved the issue by changing the python version from 3.8 to 3.7 in the lambda. The script now runs successfully
Multiprocessing + Flask OSError: [Errno 48] Address already in use / OSError: [Errno 38] Socket operation on non-socket
Replace
app.run(port=8000)
with
if __name__ == '__main__':
app.run(port=8000)
When using multiprocessing, anything that is "top level" gets run in every thread. So both your main thread and the thread you're creating try to open port 8000
Python multiprocessing: Permission denied
For POSIX semaphores to work, the users need r/w access to shared memory (/dev/shm
).
Check the permissions to /dev/shm
. On my laptop (Ubuntu) it looks like this:
$ ls -ld /dev/shm
drwxrwxrwt 2 root root 40 2010-01-05 20:34 shm
To permanently set the correct permissions (even after a reboot), add the following to your /etc/fstab
:
none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0
Haven't tried this, just copied from a forum post.
Multiprocess and Multiprocessing with no file IO: OSError: [Errno 24] Too many open files
The way to avoid changing the ulimit is to make sure that your process pool size does not increase beyond 1024. That's why 1000 works and 10000 fails.
Here's an example of managing the processes with a Pool which will ensure you don't go above the ceiling of your ulimit value:
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
with Pool(5) as p:
print(p.map(f, [1, 2, 3]))
https://docs.python.org/3/library/multiprocessing.html#introduction
other threads recommend closing any opened files but I do not access
files in my code
You don't have files open, but your processes are opening file descriptors which is what the OS is seeing here.
Related Topics
What Is the Naming Convention in Python For Variable and Function
Python: Interplay Between Lib/Site-Packages/Site.Py and Lib/Site.Py
How to Delete a Directory Created with Tempfile.Mkdtemp
How to Find Out the Date of the Last Saturday in Linux Shell Script or Python
Python: Xlib -- How to Raise(Bring to Top) Windows
Python: Complexity of Os.Path.Exists with a Ext4 Filesystem
Pythonic Way to Combine Two Lists in an Alternating Fashion
How to Get the Full Path of the Current File'S Directory
Run a Python Script in Terminal Without the Python Command
Running Python Script as a Systemd Service
Writing to Shared Memory in Python Is Very Slow
Ctypes Loading a C Shared Library That Has Dependencies
Python Portable, Linux & Windows
Histogram of an Image's "Black Ink Level" by Horizontal Axis