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

php_cli Segmentation fault #8950

Closed
TheOneThingSpecial opened this issue Jul 8, 2022 · 4 comments
Closed

php_cli Segmentation fault #8950

TheOneThingSpecial opened this issue Jul 8, 2022 · 4 comments

Comments

@TheOneThingSpecial
Copy link

Description

The following code:
Sometimes when I run php script using php command,I get a Segmentation fault.
I don't know why.so I need some help!

<?php
require_once "/var/www/html/function.php";
require_once "/var/www/html/send_sms.php";
global $DB;
$path = '/var/www/html//times/';
$fileName = 'sendTimes.json';
$sql = "SELECT DeviceID,Tel,AdminID FROM  TSMSCode GROUP BY DeviceID,Tel,AdminID";
$res = $DB->getFetchAll($sql);
if (!file_exists($path . $fileName)) {
    cutil_php_debug("File not exist ,Quit!", 'SmsLimitReset');
    exit;
}
$sendSMS = AjaxSend_SMS::recordSMSTimes($sendSMS, 1);
if (is_array($res) && count($res) > 0) {
    foreach ($res as $index => $smsVal) {
        $id = 0;
        $SendType = $smsVal['AdminID'] > 0 ? 'admin' : 'user';
        if ($SendType === 'admin') {
            $id = $smsVal['AdminID'];
        } else {
            $id = $smsVal['DeviceID'];
        }

        if (isset($sendSMS[$SendType][$id][$smsVal['Tel']])
            && $sendSMS[$SendType][$id][$smsVal['Tel']]['expired'] < time()
            && $sendSMS[$SendType][$id][$smsVal['Tel']]['usedTimes'] >= AjaxSend_SMS::getSendTimes('times')) {
            $sendSMS[$SendType][$id][$smsVal['Tel']] = AjaxSend_SMS::defaultSmsLimit();
            // print_r($sendSMS);
            AjaxSend_SMS::recordSMSTimes($sendSMS);
            cutil_php_debug("Reset Device :" . $smsVal['DeviceID'] . " Tel:" . $smsVal['Tel'], 'SmsLimitReset');
        }
    }
}


Resulted in this output:
![image](https://user-images.githubusercontent.com/14242762/177926637-29e1c6d9-475f-4357-a6ef-dcf80d272b8a.png)

But I expected this output instead:
run success!

there is a core dump file:
[core.php.1498679.11.zip](https://github.com/php/php-src/files/9069261/core.php.1498679.11.zip)

I have tried using gdb command to analyze core dump file,but I still don't know why.
I hope the screenshots below are of some help to you:
![image](https://user-images.githubusercontent.com/14242762/177928126-937f3e56-d16c-4c72-b4e1-49ddb6005f7f.png)
![image](https://user-images.githubusercontent.com/14242762/177929064-917c0167-e9e5-4474-afea-fed24707b299.png)



### PHP Version

PHP 7.3.24

### Operating System

Centos 6.10
@devnexen
Copy link
Member

devnexen commented Jul 8, 2022

Note php 7.3 releases are no longer supported.

@damianwadley
Copy link
Member

Can you reproduce this with PHP 8.0 or later?

Given that it will be difficult for someone to read that core file unless they have a similar system setup, what does a backtrace in gdb show? Do you have any non-standard PHP extensions loaded?

@TheOneThingSpecial
Copy link
Author

I don't have non-standard PHP extensions loaded.
When free_pages=511,I got segment falut,Can you think of any GC principle?
image

@nielsdos
Copy link
Member

Given that this was produced with an unsupported PHP version at the time and there have been countless bugfixes since then, and the fact that we don't have a reproducer; this issue is unactionable and I'll close it. If you still experience this and have a reproducer please comment here and I can reopen.

@nielsdos nielsdos closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants