mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Remove broken hack in mysqlnd_vio::close_stream
What happens is that the persistent network stream resource gets freed, yet stays inside EG(persistent_list). This causes a crash on shutdown when the persistent list is getting cleared, as the engine will try to free the network stream again. The code in close_stream gets confused between persistent vs non-persistent allocations when EG(active) is false. This code was introduced inc3019a1
to fix crashes when the persistent list gets destroyed before module shutdown is called. This is indeed a potential problem that was fixed on the master branch in5941cda
. This fixes the crash reason of GH-10599.
This commit is contained in:
parent
4f0d4c0872
commit
06b87f912b
1 changed files with 3 additions and 7 deletions
|
@ -652,15 +652,11 @@ MYSQLND_METHOD(mysqlnd_vio, close_stream)(MYSQLND_VIO * const net, MYSQLND_STATS
|
|||
bool pers = net->persistent;
|
||||
DBG_INF_FMT("Freeing stream. abstract=%p", net_stream->abstract);
|
||||
/* We removed the resource from the stream, so pass FREE_RSRC_DTOR now to force
|
||||
* destruction to occur during shutdown, because it won't happen through the resource. */
|
||||
/* TODO: The EG(active) check here is dead -- check IN_SHUTDOWN? */
|
||||
if (pers && EG(active)) {
|
||||
* destruction to occur during shutdown, because it won't happen through the resource
|
||||
* because we removed the resource from the EG resource list(s). */
|
||||
if (pers) {
|
||||
php_stream_free(net_stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
|
||||
} else {
|
||||
/*
|
||||
otherwise we will crash because the EG(persistent_list) has been freed already,
|
||||
before the modules are shut down
|
||||
*/
|
||||
php_stream_free(net_stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
|
||||
}
|
||||
net->data->m.set_stream(net, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue