swoole / ext-postgresql

🐘 Coroutine-based client for PostgreSQL
64 stars 21 forks source link

segmentation fault #78

Open lincepro opened 2 years ago

lincepro commented 2 years ago

image

<?php  
echo "php version:" . PHP_VERSION . "\n";  
echo "swoole version:" . swoole_version(). "\n";  
\Co\run(function (){  
    $obj = new \Co\PostgreSQL();  
    $obj->connect("host=127.0.0.1 port=5432 dbname=postgres user=postgres password=");  
    $obj->query("drop table if exists foo");  
    $obj->query("create table foo(id int, uid int)");  
    $obj->metaData('foo');  
    try{  
        // 不存在的类  
        new foo;  
    } catch(\Throwable $e) {  
        echo "error:" . $e->getMessage()  . "\n";  
    }  
    echo "无法执行的代码\n";  
    echo "去掉metaData函数就能正常执行\n";  
});  
Yurunsoft commented 2 years ago

你是用的那个版本的 swoole_postresql

lincepro commented 2 years ago

你是用的那个版本的 swoole_postresql

昨天下载的最新版 master分支

Yurunsoft commented 2 years ago

我这边没有复现,你装一下 valgrind 吧 然后用这个命令测试,把日志文件附件发上来 USE_ZEND_ALLOC=0 valgrind --leak-check=full --log-file=leak.log php test.php

lincepro commented 2 years ago

image 用valgrind 之后段错误消失了 leak.log.tar.gz

我这边没有复现,你装一下 valgrind 吧 然后用这个命令测试,把日志文件附件发上来 USE_ZEND_ALLOC=0 valgrind --leak-check=full --log-file=leak.log php test.php

Yurunsoft commented 2 years ago

更新一下PHP版本吧

lincepro commented 2 years ago

USE_ZEND_ALLOC=0 valgrind --leak-check=full --log-file=leak.log php test.php

image 升级到最新的8.1.8了