sapling/mercurial/hgweb
Gregory Szorc 4e3c6d9b7a hgweb: consume generator inside context manager (issue4756)
If code inside a context manager returns a generator, the context
manager exits before the generator is iterated.

hgweb was using a context manager to control thread safe access to a
localrepository instance. But it was returning a generator, so there was
a race condition between a previous request streaming a response to the
client and a new request obtaining the released but in use repository.
By iterating the generator inside the context manager, we ensure we
don't release the repo instance until after the response has finished.

With this change, hgweb finally appears to have full localrepository
isolation between threads. I can no longer reproduce the 2 exceptions
reported in issue4756.

test-hgweb-non-interactive.t has been modified to consume the output
of calling into a WSGI application. Without this, execution of the WSGI
application stalls because of the added yield statement.
2015-09-12 12:16:39 -07:00
..
__init__.py hgweb: make hgweb.hgweb a unified interface to hgweb/hgwebdir 2010-04-26 11:03:40 -05:00
common.py hgweb: remove ErrorResponse.message 2015-09-08 14:56:29 -04:00
hgweb_mod.py hgweb: consume generator inside context manager (issue4756) 2015-09-12 12:16:39 -07:00
hgwebdir_mod.py hgweb: make refresh interval configurable 2015-08-22 22:59:51 -07:00
protocol.py wireproto: introduce an abstractserverproto class 2014-03-28 11:10:33 -07:00
request.py hgweb: remove ErrorResponse.message 2015-09-08 14:56:29 -04:00
server.py hgweb.server: fix _httprequesthandlerssl help text 2015-09-08 15:32:20 -04:00
webcommands.py hgweb: move archive related attributes to requestcontext 2015-08-22 15:12:52 -07:00
webutil.py hgweb: extract web substitutions table generation to own function 2015-08-22 15:40:33 -07:00
wsgicgi.py hgweb.cgi: fix internal WSGI emulation (issue3804) 2013-02-04 23:25:25 +01:00