[New-bugs-announce] [issue29208] BlockingIOError during system startup

Dustin Spicuzza report at bugs.python.org
Sun Jan 8 11:50:12 EST 2017

New submission from Dustin Spicuzza:

I haven't dug into this very deeply yet, so I'm seeking some clarity on this issue before doing so.

According to my reading of PEP 522 (https://www.python.org/dev/peps/pep-0522/), BlockingIOError will be raised in security sensitive APIs, but not when just importing the random module. However, it seems that this is not actually the case:

BlockingIOError: [Errno 11] Resource temporarily unavailable 
 The above exception was the direct cause of the following exception: 
 Traceback (most recent call last): 
   File "/home/lvuser/py/robot.py", line 15, in <module> 
     import wpilib 
   File "/usr/local/lib/python3.6/site-packages/wpilib/__init__.py", line 72, in <module> 
     from ._impl.main import run 
   File "/usr/local/lib/python3.6/site-packages/wpilib/_impl/main.py", line 7, in <module> 
     from pkg_resources import iter_entry_points 
   File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 36, in <module> 
     import email.parser 
   File "/usr/local/lib/python3.6/email/parser.py", line 12, in <module> 
     from email.feedparser import FeedParser, BytesFeedParser 
   File "/usr/local/lib/python3.6/email/feedparser.py", line 27, in <module> 
     from email._policybase import compat32 
   File "/usr/local/lib/python3.6/email/_policybase.py", line 9, in <module> 
     from email.utils import _has_surrogates 
   File "/usr/local/lib/python3.6/email/utils.py", line 28, in <module> 
     import random 
   File "/usr/local/lib/python3.6/random.py", line 742, in <module> 
     _inst = Random() 
 SystemError: <class 'random.Random'> returned a result with an error set 

Background: I'm the maintainer of the RobotPy project, which allows students to use Python to control their robots in the FIRST Robotics competition. The robot controller we use is an NI roboRIO, which is powered by an ARM cortex-a9.

This error was encountered when the robot is booting up with a python program. Presumably the program is started early enough in the boot process where the urandom blocking issue mentioned in the PEP occurs.

I'd love some help figuring out what's going on here, and the best way to fix it. Thanks!

I'm also tracking this issue at https://github.com/robotpy/robotpy-wpilib/issues/243

components: Library (Lib)
messages: 284996
nosy: virtuald
priority: normal
severity: normal
status: open
title: BlockingIOError during system startup
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list