This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: instanciation of multiprocessing.Queue raises ImportError in test_logging
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: davin, python-dev, serhiy.storchaka, vinay.sajip, xdegaye
Priority: normal Keywords: patch

Created on 2016-11-11 15:48 by xdegaye, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test__multiprocessing_queue.patch xdegaye, 2016-11-11 15:47 review
test_multiprocessing_queue_2.patch xdegaye, 2016-11-12 10:46 using a plain decorator with no argument review
Pull Requests
URL Status Linked Edit
PR 4560 merged xdegaye, 2017-11-25 14:33
Messages (9)
msg280589 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-11-11 15:47
Occurs on Android that has a broken shared semaphore implementation (issue 26924).
Patch attached.

One of the backtraces:

======================================================================
ERROR: test_handle_called_with_mp_queue (test.test_logging.QueueListenerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/multiprocessing/synchronize.py", line 29, in <modu
le>
    from _multiprocessing import SemLock, sem_unlink
ImportError: cannot import name 'sem_unlink'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/unittest/mock.py", line 1179, in patched
    return func(*args, **keywargs)
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_logging.py", line 3130, in test_handle_c
alled_with_mp_queue
    log_queue = multiprocessing.Queue()
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/multiprocessing/context.py", line 102, in Queue
    return Queue(maxsize, ctx=self.get_context())
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/multiprocessing/queues.py", line 39, in __init__
    from .synchronize import SEM_VALUE_MAX as maxsize
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/multiprocessing/synchronize.py", line 34, in <modu
le>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required sync
hronization primitives needed will not function, see issue 3770.
msg280593 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-11 16:16
The decorator doesn't need arguments. I would make it similar to skip_unless_symlink.
msg280649 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-11-12 10:46
When the test is to be skipped:
  * The decorator in the previous patch (a decorator with arguments that takes no argument) returns a decorator which is unittest.skip (to be applied to the test method).
  * On the other side, the skip_unless_symlink decorator pattern (no argument) applies the unittest.skip decorator to the test method and returns the decorated test method.
This new patch uses the second method suggested by Serhiy.
msg280651 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-12 11:18
requires_multiprocessing_queue is used only in test_logging. Is it worth to add it in test.support?
msg280654 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-11-12 12:12
IMHO other tests in the future may instantiate multiprocessing.Queue() and come up with another new decorator when the test fails on the (yet to come) Android buildbot, ignoring that one already exists if we move the decorator to the test_logging module.
msg280660 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-11-12 12:41
Okay. test_multiprocessing_queue_2.patch LGTM.
msg280862 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-15 16:06
New changeset a377e6987821 by Xavier de Gaye in branch '3.5':
Issue 28668: Skip tests where instanciation of multiprocessing.Queue
https://hg.python.org/cpython/rev/a377e6987821

New changeset e5404ba1b19e by Xavier de Gaye in branch '3.6':
Issue 28668: Merge 3.5
https://hg.python.org/cpython/rev/e5404ba1b19e

New changeset 1f0b0ecf7dc1 by Xavier de Gaye in branch 'default':
Issue 28668: Merge 3.6
https://hg.python.org/cpython/rev/1f0b0ecf7dc1
msg306958 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-25 14:40
The multiprocessing module is not functional when the multiprocessing.synchronize module cannot be imported and all the multiprocessing tests are skipped in that case. Use the same idiom (i.e. test.support.import_module('multiprocessing.synchronize')) to skip the tests when the platform sem_open implementation is broken and remove test.support.requires_multiprocessing_queue.
msg307366 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-12-01 07:08
New changeset bf2b65e413ca5ec705c7e2f463d0d75e947588a4 by xdegaye in branch 'master':
bpo-28668: test.support.requires_multiprocessing_queue is removed (GH-4560)
https://github.com/python/cpython/commit/bf2b65e413ca5ec705c7e2f463d0d75e947588a4
History
Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72854
2017-12-01 07:09:37xdegayesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-12-01 07:08:51xdegayesetmessages: + msg307366
2017-11-25 14:40:48xdegayesetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg306958

stage: resolved -> patch review
2017-11-25 14:33:14xdegayesetpull_requests: + pull_request4489
2016-11-15 18:51:55xdegayesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-11-15 16:06:56python-devsetnosy: + python-dev
messages: + msg280862
2016-11-12 12:41:54serhiy.storchakasetmessages: + msg280660
2016-11-12 12:12:28xdegayesetmessages: + msg280654
2016-11-12 11:38:54xdegayelinkissue26865 dependencies
2016-11-12 11:18:30serhiy.storchakasetmessages: + msg280651
2016-11-12 10:46:29xdegayesetfiles: + test_multiprocessing_queue_2.patch

messages: + msg280649
2016-11-11 20:01:41davinsetnosy: + davin
2016-11-11 16:16:17serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg280593
2016-11-11 15:48:00xdegayecreate