unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [ANN] unicorn 0.96.1 - leak fix for Rainbows!/Zbatery
@ 2010-02-13 10:34 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2010-02-13 10:34 UTC (permalink / raw)
  To: ruby-talk ML, mongrel-unicorn, rainbows-talk

First off, this memory leak doesn't affect Unicorn itself at all
(but it doesn't hurt, either).

Unicorn itself always allocates the HttpParser once and always reuses it
in every sequential request.

This leak only affects applications that repeatedly allocate a new HTTP
parser.  Thus this bug affects _all_ deployments of Rainbows! and
Zbatery.  These servers allocate a new parser for every client
connection to serve clients concurrently, but due to a bug in Unicorn,
never allows the Ruby GC to properly free the memory allocated.

Here's what happened:

  I misread the Data_Make_Struct()/Data_Wrap_Struct()
  documentation and ended up passing NULL as the "free" argument
  instead of -1, causing the memory to never be freed.

  From README.EXT in the MRI source which I misread:
  > The free argument is the function to free the pointer
  > allocation.  If this is -1, the pointer will be just freed.
  > The functions mark and free will be called from garbage
  > collector.

Yes, I suck at reading and can't write code properly as a result.

* http://unicorn.bogomips.org/
* mongrel-unicorn@rubyforge.org
* git://git.bogomips.org/unicorn.git

Eric Wong

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-13 10:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-13 10:34 [ANN] unicorn 0.96.1 - leak fix for Rainbows!/Zbatery Eric Wong

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).