Skip to content

command.process() fails if the terminal is missing #1264

Open

Description

@jlu5

Reported by AlexPortable in #limnoria:

ERROR 2016-09-11T18:24:13 supybot Uncaught exception in _callRegexp:
Traceback (most recent call last):
  File "/home/alexportable/.local/lib/python3.5/site-packages/supybot/callbacks.py", line 1478, in _callRegexp
    method(irc, msg, m)
  File "/home/alexportable/limnoria/plugins/SedRegex/plugin.py", line 148, in replacer
    fcn_name='replacer'):
  File "/home/alexportable/.local/lib/python3.5/site-packages/supybot/commands.py", line 149, in regexp_wrapper
    v = process(re_bool, s, reobj, timeout=timeout, pn=plugin_name, cn=fcn_name)
  File "/home/alexportable/.local/lib/python3.5/site-packages/supybot/commands.py", line 119, in process
    p.start()
  File "/home/alexportable/.local/lib/python3.5/multiprocessing/process.py", line 105, in start
    self._popen = self._Popen(self)
  File "/home/alexportable/.local/lib/python3.5/multiprocessing/context.py", line 212, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/home/alexportable/.local/lib/python3.5/multiprocessing/context.py", line 267, in _Popen
    return Popen(process_obj)
  File "/home/alexportable/.local/lib/python3.5/multiprocessing/popen_fork.py", line 17, in __init__
    sys.stdout.flush()
OSError: [Errno 5] Input/output error
ERROR 2016-09-11T18:24:13 supybot Exception id: 0x28bfa

Relevant conversation:

09:28 <tacocat> AlexPortable: is supybot running daemonized, in the foreground, or sent to the background?
09:29 <AlexPortable> foregroudn
09:29 <AlexPortable> but my terminal closed due to inactivity
09:29 <AlexPortable> other plugins work fine
09:30 <tacocat> can you restart your bot with 'supybot -d' so that it forks to the background
09:30 <tacocat> doing a bit of research and sys.stdXXX.flush() failing may be because the terminal is dead
09:30 <AlexPortable> i start it with crontab
09:31 <tacocat> use supybot -d there
09:31 <tacocat> i'm not sure crontab even exposes a terminal for the bot to attach to
09:32 <AlexPortable> so shutdown the bot and try again?
09:32 <tacocat> yes but don't do anything to make it lose terminal
09:32 <AlexPortable> supybot -d bot.conf ?
09:32 <tacocat> if you daemonize it there is no terminal
09:32 <tacocat> yup
09:33 <AlexPortable> done
09:34 <AlexPortable> hm m the other plugins work too :D
09:34 <AlexPortable> thanks :D

Activity

  1. progval commented on Sep 11, 2016

    @progval
    Owner

    hmm... isn't it a bug in CPython?

  2. progval commented on Oct 1, 2016

    @progval
    Owner

    Submitted to Python's bugtracker. https://bugs.python.org/issue28326

  3. progval commented on Oct 22, 2017

    @progval
    Owner

    This issue will be fixed on Python 3.6.4: python/cpython#4075

  4. jlu5 commented on Jan 25, 2018

    @jlu5
    CollaboratorAuthor

    3.6.4 has been released, so I think this can be closed now.

    Not quite, python/cpython#4075 (comment)

  5. sunbarve commented on May 25, 2018

    @sunbarve

    Is this issue solve for python3.5?

    File "/home/alexportable/.local/lib/python3.5/multiprocessing/popen_fork.py", line 17, in init
    sys.stdout.flush()
    OSError: [Errno 5] Input/output error

  6. progval commented on May 25, 2018

    @progval
    Owner

    No, you need at least Python 3.6.4.

  7. sunbarve commented on May 25, 2018

    @sunbarve

    @progval i have upgraded python to 3.6.4, but still get this error.
    File "/usr/local/lib/python3.6/multiprocessing/popen_fork.py", line 18, in init
    sys.stdout.flush()
    OSError: [Errno 5] Input/output error

  8. progval commented on May 25, 2018

    @progval
    Owner

    What does python3 -V show?

  9. sunbarve commented on May 26, 2018

    @sunbarve

    @progval
    1.if i just use python3 -V then it shown Python 3.5.2
    2.if use python3.6 -V then it shows Python 3.6.4

  10. jothiljose commented on Aug 1, 2018

    @jothiljose

    I am also facing this same while hosting in AWS,
    Just remove the code sys.stdout.flush() from source file , now its working perfectly.
    let me know, Is this make any issue in future?

  11. progval commented on Aug 1, 2018

    @progval
    Owner

    @jothiljose You should use this patch: https://github.com/python/cpython/pull/4075/files but replace except (AttributeError, ValueError): with except (AttributeError, ValueError, OSError):

  12. traumschule commented on Dec 13, 2018

    @traumschule

    Hi! I see the same issue with current limnoria after the parent tmux had died.

    The current (running) version of this Limnoria is 2018.09.09, running on Python 3.6.5 (default, Jul 30 2018, 14:52:52) [GCC 7.3.0]. The newest versions available online are 2018.09.09 (in master), 2018.10.14 (in testing)

    Will try the linked patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions