-
Notifications
You must be signed in to change notification settings - Fork 8k
Patch for bug #69860 #2375
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
Patch for bug #69860 #2375
Conversation
|
This should not target a release branch, 7.0 is the development branch, please target that. |
| return -1; | ||
| } | ||
| if (fcgi_read_request(req)) { | ||
| req->hook.on_read(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the fastcgi code, just trying to figure out how all this works... Looking at the current implementation of fcgi_accept_request, if fd < 0, we are first calling on_accept() then accept(), then on_read(), then poll() or select(), then fcgi_read_request(). If fd >= 0, then only fcgi_read_request() is called.
This patch changes to call on_read() also after fcgi_read_request(). However, doesn't that mean that in the case of fd < 0, we will end up calling on_read() twice? Similarly, should on_read be called before fcgi_read_request() or after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a more general question: Can someone tell me why the poll/select is only done for the fd<0 case? Why is this not applicable to the keepalive case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't that mean that in the case of fd < 0, we will end up calling on_read() twice
That can be the case, yes. Current implementation of php-fpm uses this hook just to zero variables, so it's not a problem. But if you think this should fire only once I can dig into it...
Similarly, should on_read be called before fcgi_read_request() or after?
Again, since it's just resetting variables it doesn't matter as far as I understand. But I don't know what the author of that code really wanted for this hook.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also a more general question: Can someone tell me why the poll/select is only done for the fd<0 case? Why is this not applicable to the keepalive case?
Erm, maybe because in keepalive case the connection is already there and no need to add it to select() set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably horribly misunderstanding something here... But isn't the connection also already there is in the case where initially fd was <0? After all, the poll/select is run after the accept(), not before it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh, I get it know. The poll/select is there to add a 5 second timeout for the initial read after accept. Of course this should not be there for a keepalive connection.
|
@dyeldandi see that you respond to @nikic in new PR, I have not reviewed this patch, he has, and raises good questions ;) |
Replacement for PR #1427