diff mercurial/bundle2.py @ 26144:4bc3707f3e67

bundle2: don't try to recover from a GeneratorExit (issue4785) GeneratorExit means the other end of the conversation has already stopped listening, so don't try and yield out error information. Instead, just let the GeneratorExit propagate normally. This should resolve esoteric issues observed with servers that have aggressive timeouts waiting for data to send to clients logging internal Python errors[0]. This has been observed with both gunicorn's gevent worker model and with scm-manager's built-in webserver (which itself is something sitting inside jetty.) 0: Exception RuntimeError: 'generator ignored GeneratorExit' in <generator object getchunks at 0x7fd2f6c586e0> ignored
author Augie Fackler <augie@google.com>
date Tue, 01 Sep 2015 15:47:33 -0400
parents 8221fefaea08
children 521b4d061d4a
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Sep 01 16:46:05 2015 -0700
+++ b/mercurial/bundle2.py	Tue Sep 01 15:47:33 2015 -0400
@@ -847,6 +847,12 @@
                 outdebug(ui, 'payload chunk size: %i' % len(chunk))
                 yield _pack(_fpayloadsize, len(chunk))
                 yield chunk
+        except GeneratorExit:
+            # GeneratorExit means that nobody is listening for our
+            # results anyway, so just bail quickly rather than trying
+            # to produce an error part.
+            ui.debug('bundle2-generatorexit\n')
+            raise
         except BaseException as exc:
             # backup exception data for later
             ui.debug('bundle2-input-stream-interrupt: encoding exception %s'