Skip to content
Snippets Groups Projects
  1. Apr 17, 2017
  2. Apr 14, 2017
    • Gregory Szorc's avatar
      tests: add tests for poorly behaving HTTP server · c85f19c66e8d
      Gregory Szorc authored
      I've spent several hours over the past few weeks investigating
      networking failures involving hg.mozilla.org. As part of this, it
      has become clear that the Mercurial client's error handling when
      it encounters network failures is far from robust.
      
      To prove this is true, I've devised a battery of tests simulating
      various network failures, notably premature connection closes. To
      achieve this, I've implemented an extension that monkeypatches the
      built-in HTTP server and hooks in at the socket level and allows
      various events to occur based on config options. For example, you
      can refuse to accept() a client socket or you can close() the socket
      after N bytes have been sent or received. The latter effectively
      simulates an unexpected connection drop (and these occur all the
      time in the real world).
      
      The new test file launches servers exhibiting various "bad" behaviors
      and points a client at them. As the many TODO comments in the test
      call attention to, Mercurial often displays unhelpful errors when
      network-related failures occur. This makes it difficult for users
      to understand what's going on and difficult for server administrators
      to pinpoint root causes without packet tracing.
      
      Upcoming patches will attempt to fix these error handling
      deficiencies.
      c85f19c66e8d
Loading