Skip to content

Conversation

@dyeldandi
Copy link
Contributor

Replacement for PR #1427

@nikic nikic changed the base branch from PHP-7.0.16 to PHP-7.0 February 9, 2017 10:50
@nikic nikic changed the base branch from PHP-7.0 to PHP-7.0.16 February 9, 2017 10:50
@krakjoe
Copy link
Member

krakjoe commented Feb 9, 2017

This should not target a release branch, 7.0 is the development branch, please target that.

@krakjoe krakjoe added the Bug label Feb 9, 2017
This was referenced Feb 9, 2017
return -1;
}
if (fcgi_read_request(req)) {
req->hook.on_read();
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

@dyeldandi dyeldandi Feb 9, 2017

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.

Copy link
Contributor Author

@dyeldandi dyeldandi Feb 9, 2017

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?

Copy link
Member

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.

Copy link
Member

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 dyeldandi mentioned this pull request Feb 9, 2017
@dyeldandi
Copy link
Contributor Author

@krakjoe
Submitted PR #2379 targeting branch PHP-7.0. I'll close this, sorry for the confusion.

@dyeldandi dyeldandi closed this Feb 9, 2017
@krakjoe
Copy link
Member

krakjoe commented Feb 9, 2017

@dyeldandi see that you respond to @nikic in new PR, I have not reviewed this patch, he has, and raises good questions ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants