[RFC/PATCH] event_machine: lazily set async env keys

James Tucker jftucker at gmail.com
Thu Jul 15 17:43:06 EDT 2010

On 15 Jul 2010, at 22:05, Eric Wong wrote:

> James Tucker <jftucker at gmail.com> wrote:
>> On 15 Jul 2010, at 07:03, Eric Wong wrote:
>>> This has the small likelyhood of breaking apps that
>>> check via:
>>> env.include?("async.callback")
>>> Or any of member?/has_key?/key?, as they're all the same method.
>> Just regarding the async close, it's used primarily when the client
>> disconnects so that you can stop asynchronous operations. It's quite
>> important from a resource standpoint.
> OK, but the EM::DefaultDeferrable object is never touched (or
> even instantiated), then there's no need to close it.
>> Why don't you just use a lambda instead of a method?
>> lambda { |*args| em_write_response(*args) }
>> That'd avoid the leak, and provide nearly the same performance
>> profile. In fact on 1.9, lambdas are pretty damn quick.
> Durr... I didn't think of that :x
> Since 1.9.2 is in RC with few users and this bug has a fix (at
> http://redmine.ruby-lang.org/issues/show/3466), we might as well leave
> the code as-is for now and skip my proposed patch.  Any objections?
> I try to avoid working around other projects' bugs (and just helping fix
> them).  This is especially the case for things like 1.9.2 which is still
> in the very early stages of adoption.

I have a similar patchset i'm not putting in for Thin. Also, the EM adjustment I made merely reduces the impact, and also increases performance:


More information about the rainbows-talk mailing list