fukamachi / woo

A fast non-blocking HTTP server on top of libev
http://ultra.wikia.com/wiki/Woo_(kaiju)
MIT License
1.28k stars 98 forks source link

* Fix bug : socket were not closed after shutdown #27

Closed kayhman closed 9 years ago

kayhman commented 9 years ago

Hi,

First, thanks for woo, which, even though being in alpha state, seems quite promising :)

In my company, we are collecting data from various energy infrastructures, at a very hight rate. The current open source time-serie databases are not fast enough for our requirement.

Therefore we are developping our own technology, and as data are recorded using http request, we want to optimize this part as well.

And woo seems a good candidate. So I've integrated it in our solution, and I've discovered a small bug. With this simple code:

(woo:run
  (lambda (env)
    (declare (ignore env))
    '(200 (:content-type "text/plain") ("Hello, World"))))

Each time you make a request using

# curl -X GET http://localhost:5000/

a new socket is created, shudowned, but not closed !

If you use lsof to the the number of file open by your favorite lisp environment :

# lsof -p mySbclPid |wc

You'll see that they augment after each http request.

I provide in this merge request a few changes that fix this issue.

Regards,

Guillaume

fukamachi commented 9 years ago

Fixed at https://github.com/fukamachi/woo/commit/e6b0166db17d184f9862ef168904e6f86f505d3f by replacing wsock:shutdown by wsys:close. Thank you for pointing out the problem!