hg serve keeps crashing with "bad file descriptor" in book.pyo
Matt Mackall
mpm at selenic.com
Tue Nov 20 05:59:46 UTC 2012
On Mon, 2012-11-19 at 23:02 +0100, Jaap Sperling wrote:
> After running quite happily for a couple of months, our Mercurial
> "server" has suddenly become really unstable. About 2 or 3 times a day
> it suddenly started crashing.
It probably coincided with someone configuring a new hook. Your server's
WSGI implementation appears to be hostile to our hook IO redirection
code. Interesting... what are you using?
> C:\Users\Mercurial>hg --version
> Mercurial Distributed SCM (version 2.3.2)
That was released Oct 1 (not yet months).
> File "mercurial\hook.pyo", line 154, in hook
> OSError: [Errno 9] Bad file descriptor
This code prevents hooks from writing to stdout, etc. as that's prone to
causing protocol issues. WSGI servers often have dummy file objects
here, but yours seems to have bogus file descriptors instead that bypass
our checks:
stdoutno = sys.__stdout__.fileno()
stderrno = sys.__stderr__.fileno()
# temporarily redirect stdout to stderr, if possible
if stdoutno >= 0 and stderrno >= 0:
sys.__stdout__.flush()
-> oldstdout = os.dup(stdoutno)
..and this only gets run for hooks. In this case, seems to be a listkeys
hook.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list