3 ms·
I may be missing something here. I do see that the patch[1] now creates a new request object, and thus a new "env" Ruby hash for each request. But I don't see
by tyingq 6y ago
I may be missing something here. I do see that the patch[1] now creates a new request object, and thus a new "env" Ruby hash for each request.
But I don't see the old behavior described as "allocates one single Ruby Hash that is then cleared (using Hash#clear) between each request"...even after poking around in http_request.rb and other places. I reads like the pre-patched version would just re-use the hash as-is, only overwriting/adding if it saw a new key or value, but not deleting any keys.
[1] https://yhbt.net/unicorn-public/66A68DD8-83EF-4C7A-80E8-3F1F7AB31670@github.com/ https://yhbt.net/unicorn-public/66A68DD8-83EF-4C7A-80E8-3F1F...
- lstamour 6y agoMaybe here? https://github.com/defunkt/unicorn/blob/2c347116305338710331d238fefa23f00e98cf54/ext/unicorn_http/unicorn_http.rl#L653 https://github.com/defunkt/unicorn/blob/2c347116305338710331... Admittedly, that's an older copy, I'd have to look up a newer copy of the source to see if that function or a similar one still exists. The change was made in Unicorn v6 according to https://yhbt.net/unicorn/NEWS.html https://yhbt.net/unicorn/NEWS.html so I'd have to find code earlier than that, maybe. https://yhbt.net/unicorn.git/tree/ext/unicorn_http/unicorn_http.rl#n653 https://yhbt.net/unicorn.git/tree/ext/unicorn_http/unicorn_h... looks like it's still there. If I'm reading this right, the init function in the above unicorn_http.rl function is what's referred to as HttpRequest#new thanks to https://yhbt.net/unicorn.git/tree/lib/unicorn/http_request.rb#n7 https://yhbt.net/unicorn.git/tree/lib/unicorn/http_request.r... but I might be misreading this. Actually... compared to uWSGI's source code, this is quite pleasant to read, warts and all. :D
- tyingq 6y agoAhh, yep. I hadn't thought to look at Ragel source.