ArchiveTeam / seesaw-kit

Making a reusable toolkit for writing seesaw scripts
Other
69 stars 30 forks source link

OSError: out of pty devices #55

Closed chfoo closed 9 years ago

chfoo commented 10 years ago

https://gist.github.com/Cameron-D/9171763

Received item '2498090001:2498100000' from tracker.
Starting PrepareDirectories for Item 2498090001:2498100000
Finished PrepareDirectories for Item 2498090001:2498100000
Starting WgetDownload for Item 2498090001:2498100000
Failed WgetDownload for Item 2498090001:2498100000
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/seesaw/pipeline.py", line 55, in
_enqueue_with_except
    task.enqueue(item)
  File "/usr/local/lib/python2.7/dist-packages/seesaw/externalprocess.py", line
83, in enqueue
    self.process(item)
  File "/usr/local/lib/python2.7/dist-packages/seesaw/externalprocess.py", line
100, in process
    p.run()
  File "/usr/local/lib/python2.7/dist-packages/seesaw/externalprocess.py", line
29, in run
    (master_fd, slave_fd) = pty.openpty()
  File "/usr/lib/python2.7/pty.py", line 29, in openpty
    master_fd, slave_name = _open_terminal()
  File "/usr/lib/python2.7/pty.py", line 70, in _open_terminal
    raise os.error, 'out of pty devices'
OSError: out of pty devices

Waiting 10 seconds...
chfoo commented 10 years ago

It appears to caused by a regression from fixes on #26 and #27 where _wait_for_end() is no longer called when an exception occurs. Tornado is still listening to that file descriptor. Possibly related to #48.

chfoo commented 10 years ago

It might be possible for ExternalProcess to explicitly catch and discard the error on p.stdin.write(self.stdin_data(item)) based on the assumption that AsyncPopen._wait_for_end() will handle the exit correctly. If not, expose a close() function so ExternalProcess can tell AsyncPopen to explicitly call the cleanup routines.

marcroberts commented 9 years ago

I'm still experiencing this while trying to run the warrior on heroku (I've updated the binaries required in my forked buildpack here https://github.com/marcroberts/heroku-buildpack-archiveteam-warrior)

Any ideas what to do about this?

2014-11-26T17:44:33.402939+00:00 app[seesaw.1]: Received item 'image:8rjn80:8rjnar' from tracker
2014-11-26T17:44:33.403538+00:00 app[seesaw.1]: Finished PrepareDirectories for Item image:8rjn80:8rjnar
2014-11-26T17:44:33.403587+00:00 app[seesaw.1]: Starting WgetDownload for Item image:8rjn80:8rjnar
2014-11-26T17:44:33.415178+00:00 app[seesaw.1]: Failed WgetDownload for Item image:8rjn80:8rjnar
2014-11-26T17:44:33.403146+00:00 app[seesaw.1]: Starting PrepareDirectories for Item image:8rjn80:8rjnar
2014-11-26T17:44:33.415684+00:00 app[seesaw.1]: Traceback (most recent call last):
2014-11-26T17:44:33.415686+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/seesaw/pipeline.py", line 59, in _enqueue_with_except
2014-11-26T17:44:33.415688+00:00 app[seesaw.1]:     task.enqueue(item)
2014-11-26T17:44:33.415690+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/seesaw/externalprocess.py", line 94, in enqueue
2014-11-26T17:44:33.415691+00:00 app[seesaw.1]:     self.process(item)
2014-11-26T17:44:33.415693+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/seesaw/externalprocess.py", line 112, in process
2014-11-26T17:44:33.415694+00:00 app[seesaw.1]:     p.run()
2014-11-26T17:44:33.415696+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/seesaw/externalprocess.py", line 29, in run
2014-11-26T17:44:33.415697+00:00 app[seesaw.1]:     (master_fd, slave_fd) = pty.openpty()
2014-11-26T17:44:33.415699+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/pty.py", line 29, in openpty
2014-11-26T17:44:33.415701+00:00 app[seesaw.1]:     master_fd, slave_name = _open_terminal()
2014-11-26T17:44:33.415702+00:00 app[seesaw.1]:   File "/app/.heroku/python/lib/python2.7/pty.py", line 70, in _open_terminal
2014-11-26T17:44:33.415704+00:00 app[seesaw.1]:     raise os.error, 'out of pty devices'
2014-11-26T17:44:33.415707+00:00 app[seesaw.1]: OSError: out of pty devices
chfoo commented 9 years ago

Tornado 3 comes with a tornado.process.Subprocess which didn't exist in alard's time. The seesaw.externalprocess.AsyncPopen should be using that instead. warrior-code2 doesn't upgrade Python dependencies so seesaw will need to have a legacy fallback to the current implementation.