multiprocessing.Queue() python method sandbox problem

multiprocessing.Queue() method of python getting "PermissionError: [Errno 1] Operation not permitted" error if it is sandboxed:

CODE:

import multiprocessing

tensorflow_coordinates_queue = multiprocessing.Queue()

ERROR:

./test_temp9 
Traceback (most recent call last):
  File "/Applications/test_temp9.app/Contents/MacOS/test_temp9.py", line 4, in <module>
  File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/context.py", line 103, in Queue
  File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/queues.py", line 43, in __init__
  File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/context.py", line 68, in Lock
  File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/synchronize.py", line 162, in __init__
  File "/Applications/test_temp9.app/Contents/MacOS/multiprocessing/synchronize.py", line 57, in __init__
PermissionError: [Errno 1] Operation not permitted

BUNDELED WITH NUITKA:

echo *** | sudo -S  python3.9 -m nuitka --run --standalone --macos-disable-console --macos-create-app-bundle --macos-app-mode=ui-element --enable-plugin=pyside6 --macos-app-icon=icons/app_icon.png --include-data-dir=icons=icons  test_temp9.py

SIGNED WITH FOLLOWING SH:

ENTITLEMENTS:

Answered by DTS Engineer in 801678022

It’s hard to answer this without knowing which specific Apple API is returning that error. However, it seems likely that this Python module is using either Posix or System V IPC, and there are special rules for getting those to work within the App Sandbox. For example, for Posix semaphores, the path you pass in must be of the form GGG/UUU, where GGG in an app group and UUU is a unique identifier of your choosing.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

By the way, in synchronize.py", line 57 going to following line.

sl = self._semlock = _multiprocessing.SemLock(
                    kind, value, maxvalue, self._make_name(),
                    unlink_now)

I guess it is trying to reach a shared memory. there are some discussion about this SemLock method permission problems in internet but I could not find a proper solution in internet.

It’s hard to answer this without knowing which specific Apple API is returning that error. However, it seems likely that this Python module is using either Posix or System V IPC, and there are special rules for getting those to work within the App Sandbox. For example, for Posix semaphores, the path you pass in must be of the form GGG/UUU, where GGG in an app group and UUU is a unique identifier of your choosing.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

multiprocessing.Queue() python method sandbox problem
 
 
Q