hg serve keeps crashing with "bad file descriptor" in book.pyo

Jaap Sperling jsperling at controll-it.de
Tue Nov 20 06:19:30 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20/11/2012 06:59, Matt Mackall wrote:
> 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?

Sorry, forgot to mention that this behaviour started under a previous
version, which was 2.1.x iirc; I forgot to note that as the first
thing I did was upgrade to the latest version coming with TortoiseHg.
I raised the issue with them first (issue #2273 on THG's bitbucket),
but they redirected me here.

I simply open a command box and type hg serve --web-conf hgweb.config
from the directory containing our repos. All the hgweb.config file
contains is a [paths] section with 'alias = path_to_repo' entries.


> 
>> 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.
> 

I am the 'admin' for the server and I cannot remember installing any
hooks (I looked for one to support notifying TeamCity servers but
hadn't found one yet). Here the content (edited to obfuscate) of the
Mercurial.ini file.

# Generated by TortoiseHg settings dialog
[web]
push_ssl = False
allow_push = *

[smtp]
host = <smtp_host>
port = 25
tls = True
username = <smtp_username>
password = <smtp_password>
local_hostname = <local_hostname>

[email]
from = <email_address>
to = <internal_distribution_list>
method = smtp

[extensions]
graphlog =

[tortoisehg]
defaultpush = all

[http_proxy]
host = <proxy_host_ip_and_port>
no = <some_exclusions>


Are there any other places hooks could be installed?

Thanks

Jaap

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCrIPIACgkQIV2+BFYEoM9/jgCgiJVVjmYMI1eGa7kI9z2IxDaT
nXoAniAxHzAUEQHtR/UYEOdQQ0KgwgK2
=ulSV
-----END PGP SIGNATURE-----



More information about the Mercurial mailing list