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: multiprocessing build fails on AIX - /dev/urandom (or equivalent) not found
Type: compile error Stage: needs patch
Components: Build, Extension Modules Versions: Python 3.1, Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jnoller Nosy List: davidnarayan, jnoller, srid
Priority: normal Keywords: patch

Created on 2009-08-04 19:27 by srid, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
multiprocessing-urandom-fallback.patch davidnarayan, 2009-12-03 13:17 Patch that includes a fallback to the 'random' module if os.urandom() is not available.
Messages (9)
msg91270 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-08-04 19:27
./Modules/ld_so_aix cc_r -qlanglvl=ansi -bI:Modules/python.exp build/
temp.aix-5.1-2.6/home/apy/rrun/build/activ
epython-DEV/build/py2_6_2-aix-powerpc-apyee26-rrun/python/Modules/
_multiprocessing/multiprocessing.o build/temp
.aix-5.1-2.6/home/apy/rrun/build/activepython-DEV/build/py2_6_2-aix-
powerpc-apyee26-rrun/python/Modules/_multip
rocessing/socket_connection.o build/temp.aix-5.1-2.6/home/apy/rrun/
build/activepython-DEV/build/py2_6_2-aix-pow
erpc-apyee26-rrun/python/Modules/_multiprocessing/semaphore.o -o build/
lib.aix-5.1-2.6/_multiprocessing.so
*** WARNING: importing extension "_multiprocessing" failed with <type 
'exceptions.NotImplementedError'>: /dev/u
random (or equivalent) not found
msg91319 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-08-05 13:13
Without access to an AIX machine, and even with it (I'm not an AIX guy by 
any stretch) it's going to be virtually impossible for me to fix this. A 
patch would be appreciated.
msg91343 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-08-06 01:18
I suppose multiprocessing invokes `os.random` somewhere. And os.random 
fails on AIX for obvious reasons:

>>> os.urandom(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/srid/ActivePythonEE-2.6.2.3-aix-powerpc64/i/lib/python2.6/
os.py", line 755, in urandom
    raise NotImplementedError("/dev/urandom (or equivalent) not found")
NotImplementedError: /dev/urandom (or equivalent) not found
>>> 

Why should multiprocessing require `urandom` at all? Can't it fallback 
to os.random, if os.urandom is unavailable?

try:
    os.urandom(10)
except NotImplementedError:
    urandom = os.urandom
else:
    urandom = os.random
msg95930 - (view) Author: David Narayan (davidnarayan) Date: 2009-12-03 13:17
This is a patch that I have used on AIX. The idea for this patch came
from uuid.py. This patch was created against Python 2.6.4.
msg101590 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-03-23 18:38
This also breaks pydoc on AIX (Python 2.6.5).

help> modules pydoc

Here is a list of matching modules.  Enter any module name to get more help.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/qatest/APy/lib/python2.6/site.py", line 438, in __call__
    return pydoc.help(*args, **kwds)
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1722, in __call__
    self.interact()
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1740, in interact
    self.help(request)
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1760, in help
    self.listmodules(split(request)[1])
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1865, in listmodules
    apropos(key)
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1965, in apropos
    ModuleScanner().run(callback, key)
  File "/home/qatest/APy/lib/python2.6/pydoc.py", line 1930, in run
    for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror):
  File "/home/qatest/APy/lib/python2.6/pkgutil.py", line 110, in walk_packages
    __import__(name)
  File "/home/qatest/APy/lib/python2.6/multiprocessing/__init__.py", line 63, in <module>
    from multiprocessing.process import Process, current_process, active_children
  File "/home/qatest/APy/lib/python2.6/multiprocessing/process.py", line 286, in <module>
    _current_process = _MainProcess()
  File "/home/qatest/APy/lib/python2.6/multiprocessing/process.py", line 283, in __init__
    self._authkey = AuthenticationString(os.urandom(32))
  File "/home/qatest/APy/lib/python2.6/os.py", line 756, in urandom
    raise NotImplementedError("/dev/urandom (or equivalent) not found")
NotImplementedError: /dev/urandom (or equivalent) not found
msg105832 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-05-15 22:04
Looks like this has been fixed, at least on Python trunk (2.7).
msg119554 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2010-10-25 14:18
Sridhar can you confirm if this is still a problem on 3.2?
msg119911 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-10-29 15:54
No, this is not an issue for me on Python 3.2 and AIX 5.1.
msg119913 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2010-10-29 16:04
Closing per Sridhar
History
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50894
2010-10-29 16:04:04jnollersetstatus: open -> closed

messages: + msg119913
2010-10-29 15:54:46sridsetmessages: + msg119911
versions: - Python 2.7, Python 3.2
2010-10-25 14:18:41jnollersetmessages: + msg119554
2010-05-15 22:04:36sridsetmessages: + msg105832
2010-03-23 18:38:45sridsetmessages: + msg101590
2009-12-03 13:17:44davidnarayansetfiles: + multiprocessing-urandom-fallback.patch

nosy: + davidnarayan
messages: + msg95930

keywords: + patch
2009-08-06 01:18:43sridsetmessages: + msg91343
2009-08-05 13:13:25jnollersetmessages: + msg91319
2009-08-05 10:17:13pitrousetversions: + Python 3.1, Python 2.7, Python 3.2
nosy: + jnoller

priority: normal
assignee: jnoller
stage: needs patch
2009-08-04 19:27:31sridcreate