Skip to content

Conversation

@bukka
Copy link
Member

@bukka bukka commented Jun 26, 2022

Currently some SAPI's might bail out on deactivation. One of those SAPI's is PHP-FPM that can bail out on request end if for example the connection is closed by the client (web sever). The problem is that in such case the resources are not freed and some values reset. The most visible impact can have not resetting the PG(headers_sent) which can cause errors in the next request. One such issue is described in #77780 bug which this PR fixes. It seems reasonable to separate deactivation and destroying the resource which means that the bail out will not impact it.

Alternatively to fix the mentioned bug we could just disable the bail out completely in deactivation. It is not clear to me what the purpose of that is in deactivation as this is happening after the script execution but I'm not 100% about it so this might be slightly safer and mainly applicable to all SAPI's.

This is iteration of #8876 that should be backportable to PHP-8.0 as it doesn't change the behavior of sapi_deactivate.

@bukka
Copy link
Member Author

bukka commented Jun 26, 2022

Also note that this should have a test for #77780 bug done before merging.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In regards to #8876 will the new SAPI APIs that are introduced in this PR be removed for master again?

@bukka
Copy link
Member Author

bukka commented Jun 26, 2022

@Girgias I think I will go just with this one once I have got some working test for that issue.

@bukka bukka force-pushed the sapi_deactivate_split branch from ffdc440 to 314cc7d Compare June 27, 2022 18:28
Currently some SAPIs might bail out on deactivation. One of those SAPI
is PHP-FPM that can bail out on request end if for example the
connection is closed by the client (web sever). The problem is that in
such case the resources are not freed and some values reset. The most
visible impact can have not resetting the PG(headers_sent) which can
cause erorrs in the next request. One such issue is described in #77780
bug which is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
@bukka bukka force-pushed the sapi_deactivate_split branch from 314cc7d to 573a56c Compare August 29, 2022 17:09
@bukka
Copy link
Member Author

bukka commented Sep 27, 2022

This has been already merged via f3c357c

@bukka bukka closed this Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants