Skip to content

Hao to support multiprocess Queue in Android  #2249

@onsunsl

Description

@onsunsl

Versions

  • Python: 3.8.1
  • OS: Ubuntu
  • Kivy: 1.11.1
  • Cython: 0.29.20
  • OpenJDK: 1.8

Description

I use Queue synchronize two process in the code, but there is an error when run in Android.
It works fine under Ubuntu and Windows.

# sub process
class ApiLogUploader(Process):

    def __init__(self, q):
        super(ApiLogUploader, self).__init__()
        self.q = q

# main process
from multiprocessing import Queue
api_log_uploader = ApiLogUploader(Queue())   # <----  raise a exception in here
  • Error info:

This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

Is this a Python bug in Android?

Logs

Traceback (most recent call last):
  File "/home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/multiprocessing/synchronize.py", line 28, in <module>
ImportError: cannot import name 'sem_unlink' from '_multiprocessing' (/data/user/0/org.kivy.cpos/files/app/_python_bundle/modules/_multiprocessing.cpython-38.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kivy/test/.buildozer/android/app/common/http_interface.py", line 12, in <module>
  File "/home/kivy/test/.buildozer/android/app/dataprocessing/__init__.py", line 4, in <module>
  File "/home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/multiprocessing/context.py", line 103, in Queue
  File "/home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/multiprocessing/queues.py", line 39, in __init__
  File "<frozen zipimport>", line 259, in load_module
  File "/home/kivy/test/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/multiprocessing/synchronize.py", line 30, in <module>
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.

This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770.
5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions