GithubHelp home page GithubHelp logo

test-warp-wai's Introduction

test-warp-wai

This is a repo containing code to reproduce a file handle leak in versions 0.2.6 and 0.2.7 of Haskell's hs-connection libraries.

This has been tested with both ghc 7.10.3 and ghc 8.0.1.

Reproduction

I'm assuming that this will be reproduced on Linux, but it should probably also work on OSX.

Clone this repo and the change into the freshly cloned source tree and do:

  • cabal sandbox init
  • cabal install --dependencies-only
  • cabal configure

You will now need two more terminal windows (three total) and you will need to change into the above source directory in all of them.

In the first window run:

cabal build && dist/build/dummy-https-server/dummy-https-server

which bulds everything and runs a trivially simple HTTPS server on port 3000.

In the second window run:

dist/build/test-warp-wai/test-warp-wai

which has two main threads, the first of which uses http-conduit to query the HTTPS server started in the first window. The second thread (which deliberately starts some time later) runs a trvially simple HTTP server. When it starts it will print the message "Warp server running on port 2000."

When the "Warp server running on port 2000." message appears, int the third window, run the shell script:

./hammer-continuous.sh

which uses wget to query the HTTP server running on port 2000.

Results

With the above setup using version 0.2.6 or 0.2.7 of the conection library, everything seems fine but then after a minute or two the hammer-continuous.sh shell script will fail with:

Wget connection fail. Exiting.

and the test-warp-wai program terminate after printing:

accept: resource exhausted (Too many open files)

If instead the programs are all built with version 0.2.5 of the connection library, no problem will be reported even after an hour or running.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.