Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pserve --daemon fails with "Bad file descriptor on the use of os.urandom()" #1554

Closed
zart opened this issue Feb 4, 2015 · 7 comments
Closed

Comments

@zart
Copy link

zart commented Feb 4, 2015

From IRC discussion:

<oyse> I have a problem with running pserve --daemon. It fails with Bad file
       descriptor on the use of os.urandom()
<oyse> Is this a known problem?
<oyse> I am running Pyramid 1.5.2 on Python 3.4.0
<oyse> From what I found on internet it could be related to closing of
       filedescriptor, but I would assume that would have been taken care of a
       long time ago if that was the problem
 * Zart ran python2 and python3, and looked at /proc/<pid>/fd/
<Zart> 2.7 used socket, 3.4 opens /dev/urandom. since pserve closes every fd
       after double fork() this breaks os.urandom() on py3k..
<Zart> https://docs.python.org/3/whatsnew/3.4.html#significant-optimizations
       seems like it's 3.4 specific optimizations
<Zart> https://github.com/Pylons/pyramid/blob/master/pyramid/scripts/pserve.py#L412

So it seems that lazy-init optimizations in 3.4 might be a culprit here.

@zart
Copy link
Author

zart commented Feb 4, 2015

This might have been fixed in 3.4.1 or later: http://bugs.python.org/issue21207

@digitalresistor
Copy link
Member

Downside to trying to be too smart ...

@mcdonc
Copy link
Member

mcdonc commented Apr 13, 2015

TBH I'd rather remove the --daemon feature than add a hack for versions of Python earlier then 3.4.1. So many good process managers exist; pserve should not try to be one.

@hpfmn
Copy link

hpfmn commented Sep 2, 2015

so what would you recommend to daemonize pserve?

@tseaver
Copy link
Member

tseaver commented Sep 2, 2015

http://supervisord.org/

@mmerickel
Copy link
Member

@hpfmn yes supervisord works well or every computer comes with its own init system for running services such as sysvinit, upstart or systemd.

mmerickel added a commit that referenced this issue Oct 15, 2015
…lacement

Mention Circus as a pserve --daemon replacement. Refs #1554, #1641
@digitalresistor
Copy link
Member

the --daemon feature has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants