Limnoria
Limnoria copied to clipboard
command.process() fails if the terminal is missing
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
hmm... isn't it a bug in CPython?
Submitted to Python's bugtracker. https://bugs.python.org/issue28326
This issue will be fixed on Python 3.6.4: https://github.com/python/cpython/pull/4075
~~3.6.4 has been released, so I think this can be closed now.~~
Not quite, https://github.com/python/cpython/pull/4075#issuecomment-392238187
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
No, you need at least Python 3.6.4.
@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
What does python3 -V show?
@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
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?
@jothiljose You should use this patch: https://github.com/python/cpython/pull/4075/files but replace except (AttributeError, ValueError): with except (AttributeError, ValueError, OSError):
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.