Bug 3711 - hg serve keeps crashing with "bad file descriptor"
Summary: hg serve keeps crashing with "bad file descriptor"
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-26 17:24 UTC by Matt Mackall
Modified: 2017-11-01 18:04 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Mackall 2012-11-26 17:24 UTC
From original message in thread:

http://markmail.org/message/z4mwfattukq5kpd2

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.

Operating System: Windows 2008 R2 On same server: Artifactory server Polled frequenlty (once a minute) by a remote TeamCity server

C:\Users\Mercurial>hg --version Mercurial Distributed SCM (version 2.3.2) (see http://mercurial.selenic.com for more information) (as shipped with TortoiseHg 2.5.1 - the peeps there suggested I ask here)

Error Message - --------------

192.168.1.97 - - [19/Nov/2012 17:15:53] Exception happened during processing request '/alive?cmd=listkeys': Traceback (most recent call last): File "mercurial\hgweb\server.pyo", line 77, in do_POST File "mercurial\hgweb\server.pyo", line 70, in do_write File "mercurial\hgweb\server.pyo", line 137, in do_hgweb File "mercurial\hgweb\hgwebdir_mod.pyo", line 147, in __call__ File "mercurial\hgweb\hgwebdir_mod.pyo", line 205, in run_wsgi File "mercurial\hgweb\hgweb_mod.pyo", line 128, in run_wsgi File "mercurial\hgweb\protocol.pyo", line 76, in call File "mercurial\wireproto.pyo", line 351, in dispatch File "mercurial\wireproto.pyo", line 472, in listkeys File "mercurial\localrepo.pyo", line 2571, in listkeys File "mercurial\localrepo.pyo", line 385, in hook File "mercurial\hook.pyo", line 154, in hook OSError: [Errno 9] Bad file descriptor

from Windows error code

Problem signature: Problem Event Name: BEX64 Application Name: hg.exe Application Version: 2.5.1.0 Application Timestamp: 4f3f0f36 Fault Module Name: MSVCR90.dll Fault Module Version: 9.0.30729.1 Fault Module Timestamp: 488ef624 Exception Offset: 0000000000054fc0 Exception Code: c0000417 Exception Data: 0000000000000000 OS Version: 6.1.7601.2.1.0.272.7 Locale ID: 1031 Additional Information 1: 0fda Additional Information 2: 0fdabc4da048e07035edf55e1899d577 Additional Information 3: fe33 Additional Information 4: fe33bd1312daad0644202475b0b30c79

Hope you know something to help

Thanks

Jaap
Comment 1 HG Bot 2012-11-28 17:46 UTC
Fixed by http://selenic.com/repo/hg/rev/6180dcb29ec5
Matt Mackall <mpm@selenic.com>
hooks: delay I/O redirection until we actually run a hook (issue3711)

We were attempting to redirect I/O even if no hook was actually
getting called. This defers redirection until we've found something to
do.

(please test the fix)
Comment 2 HG Bot 2012-11-28 17:46 UTC
Fixed by http://selenic.com/repo/hg/rev/2c63896783e3
Matt Mackall <mpm@selenic.com>
hooks: be even more forgiven of non-fd descriptors (issue3711)

Looks like there are instances where sys.stdout/stderr contain file
handles that are invalid. We should be tolerant of this for hook I/O
redirection, as our primary concern is not garbling our own output stream.

(please test the fix)