Skip to content
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

open file not destroy or crash in Yaf_Config_Ini, PHP 8.1 or later #587

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

xinhaiz
Copy link
Contributor

@xinhaiz xinhaiz commented Oct 23, 2023

Reported by @fnu

the open files not destroyed:

image

Affected API versions:

image
image

Inspection Code (From: @fnu):

// Get the list of open files for the current PHP process
$command = 'lsof -p ' . getmypid() . ' | wc -l'; 

$outputStart = trim(shell_exec($command));

for ($i = 0; $i < 100; $i++) {
    $a = new Yaf\Config\Ini('../conf/redis.ini');
    unset($a);
}

// Manually trigger garbage collection
$collected = gc_collect_cycles(); 
sleep(1);

echo "Collected {$collected} variables.\n";
$outputEnd = trim(shell_exec($command));

$diff = intval($outputEnd) - intval($outputStart);

echo "Start: {$outputStart}, End: {$outputEnd}, Diff: {$diff}, Collected: {$collected};", PHP_EOL;

image

@laruence laruence merged commit 34e9f43 into laruence:master Jun 26, 2024
8 checks passed
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