运行我的工作程序时出现错误:
VDAL,40,,22018364,,,,,,,,,,,,,,,,239,27/03/2019,31/12/9999,,,(some columns are not filled)
尝试通过命令行为Gearman Client运行worker时出现分段错误。
这个消息工作者在得到一些正确的答复后得到了
我的工作人员代码:
Segmentation fault (core dumped)
运行工作者:
<?php
require __DIR__ . '/vendor/autoload.php';
use ClickHouseDB\Client;
use ClickHouseDB\Quote\FormatLine;
$config = [
'host' => '',
'port' => 0,
'username' => '',
'password' => ''
];
$db = new Client($config);
$db->database('mydb');
$worker= new GearmanWorker();
$worker->addServer('127.0.0.1', '4730');
$worker->addFunction("send_to_clickhouse", "processing", $db);
while (1)
{
$worker->work();
if ($worker->returnCode() != GEARMAN_SUCCESS){
echo "return_code: " . $gmworker->returnCode() . "\n";
break;
}
}
function processing($job, $db)
{
$message = $job->workload();
$data = json_decode($message, true);
$statement = $db->insert($data['table_name'], [array_values($data['columns'])], array_keys($data['columns']));
$statement->error();
echo $data['table_name']."\n";
}
?>
工人输出:
php worker.php
我正在使用table1
table2
Segmentation fault (core dumped)
扩展名将数据发送到数据库
PHP版本:
smi2/phpclickhouse
命令PHP 7.2.15-0ubuntu0.18.04.2 (cli) (built: Mar 22 2019 17:05:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.15-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
返回:
dmesg
如果我删除代码...
[168928.288846] traps: php[29065] general protection ip:5558a2d01be0 sp:7ffc92fc4cf0 error:0 in php7.2[5558a2a87000+419000]
[168963.415479] traps: php[29071] general protection ip:55d203497ad4 sp:7ffeb5813e20 error:0 in php7.2[55d203156000+419000]
[169089.059688] traps: php[29152] general protection ip:55595db0a293 sp:7fff98ce30a0 error:0 in php7.2[55595d853000+419000]
[169280.116888] traps: php[29159] general protection ip:556772007ad4 sp:7ffc1c89b1d0 error:0 in php7.2[556771cc6000+419000]
[169282.114056] traps: php[29161] general protection ip:55ed3ab32be0 sp:7ffca8c53820 error:0 in php7.2[55ed3a8b8000+419000]
[169283.565760] traps: php[29163] general protection ip:55edd7b73ad4 sp:7ffd23dc6a10 error:0 in php7.2[55edd7832000+419000]
[169288.703892] traps: php[29165] general protection ip:558527bc5ad4 sp:7fff41e888a0 error:0 in php7.2[558527884000+419000]
[169331.512869] traps: php[29170] general protection ip:563e00ddfad4 sp:7ffd503eada0 error:0 in php7.2[563e00a9e000+419000]
[169408.724444] traps: php[29187] general protection ip:561e2ed6cbe0 sp:7ffeab26dd00 error:0 in php7.2[561e2eaf2000+419000]
[169462.063710] traps: php[29200] general protection ip:561682a69ad4 sp:7ffe4634d730 error:0 in php7.2[561682728000+419000]
,似乎一切正常。
任何想法都需要解决吗?
更新:
statement = $db->insert(...
返回此信息:
gdb
答案 0 :(得分:0)
我在运行PHP 7.2.24的Ubuntu 18.04 LTS中也遇到了这个问题。
我发现这是gearman-php扩展程序中的一个错误(已fixed)。
要解决此问题,您需要下载,编译并安装gearman pecl模块
cd /tmp/
sudo wget https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.6.zip
unzip gearman-2.0.6.zip
cd pecl-gearman-gearman-2.0.6
sudo phpize
./configure
sudo make
sudo make install
要在Ubuntu上完整安装Gearman for PHP7,请参阅此guide