-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging on hijack requests is weird #332
Comments
Yeah, logging on hijack is super weird. The issue is that the middleware stack is what actually does the logging so there isn't an easy way for puma to inject itself genericly. I'm going to make a change to the Rack::CommonLogger patch we use to detect hijacking and do something better, but that won't work in all cases because a different logger might be in the middleware stack. |
thanks, yeah the hijack protocol is weird, personally I think using Thin style throw :async after hijacking feels cleaner cause all sorts of weird can happen unwinding a big middleware stack. (etags, caching and so on) |
I'm running puma 2.6.0, and since the patch, the response code is always 'HIJACKED'. I've been unable to figure out a way to change it to anything from that without hacking the gem itself, which I'd like to avoid. The problem is that when I run puma in production mode, it always reports a 500 from this call, even though it succeeds. When run in development mode, it shows that the response code is actually HIJACKED, but I don't want to get into issues with NewRelic reporting high error rates just because it thinks the response code is bad ( though I've not tested this with NewRelic yet, but I assume it will be the case ) |
:Looking at your patch it looks like this may only effect the log entry... hopefully. |
The problem could also be that I'm a jackass. I was looking at the production.log file when running in development mode... Had I been looking at the dev log, I would've seen the actual error, which has nothing to do with this. Interesting though, that puma seems to ignore the RAILS_ENV and write to the production.log for the hijack output regardless. Likely because the environment of my lambda'd process does not have RAILS_ENV set and it's defaulting to production or something along those lines. |
Puma don't write to any log files without being told to, so thats not it writing to production.log. |
@SamSaffron we've recently authored a gem that provided this kind of async processing in Grape API (supporting the Rack Hijack API or AsyncCallback were applicable) called StuartApp/grape-async. We're about to jump into doing perf testing and I was wondering if you could provide some more details on the changes you made to your linux setup to achieve the performance you mentioned above? |
honestly I don't remember off the top of my head, raise ulimits is the main one |
Ok thanks, we’ll share any further tweaks we find that work well here in the future.
|
Take the following config.ru
after getting a request we see:
The response code is actually 200, the 418 is to be ignored by the web server so no point showing it... instead the log should read
In an ideal world you would hold of on the log till .close is called on the io, and log the time of hijack and time of close.
Also, in other news performance is spectacular with hijack on with a tuned linux
That is right ... 5000 concurrent sleeping 2 secs, all serviced with 6 secs ... not too bad.
However, if you try this on a vanilla linux, stuff can get pretty weird, recommend you test out that ab command on a system that runs out of resources during the ab test, stuff got weird.
The text was updated successfully, but these errors were encountered: