1

I am very happy that many friends are still using this project, which helped them solve some online problems.

If you are not familiar with the running logic of an online project, or you are not clear about the source of a method call, or there is an interface on the line that exits abnormally, and the online call is particularly time-consuming, it is more suitable. Use Deliverer to solve it and help you avoid running away.

https://github.com/zhoumengkang/deliverer/releases/tag/1.1.2

A few days ago, a group friend encountered some problems online and used Deliverer to troubleshoot them, but they still couldn't solve them immediately, so WeChat contacted me. I communicated with me on the use of the tool. Although the online bug was finally located through Deliverer's historical log records, I also found a problem that the Deliverer tool previously ignored:

only monitors user-defined methods and functions in order to minimize log output and performance loss, leading to some magic methods through the system, such as __get and __call .

For example, the following code

error_reporting(E_ALL);
ini_set('display_errors',true);
function aaa($a){
    return bbb($a+100);
}

function bbb($b){
    return ccc($b*100);
}

function ccc($c){
    echo 11111;
    return 1;
}

function ddd(){
    return 2;
}
class abc{
    public function test(){
        $this->aaa;
    }

    private function test2($name){
        echo $name;
        $abcd = new abcd();
        call_user_func([$abcd,"test"]);
    }

    public function __get($name)
    {
        return $this->test2($name);
    }
}

class abcd{
    public function test(){
        $this->aaa;
    }

    private function test2($name){
        $this->test3($name);
    }

    private function test3($name){
        echo $name;
    }

    public function __get($name)
    {
        return $this->test2($name);
    }
}

aaa(1234);
ddd();

$abc = new abc();
$abc->test();
$abcd = new abcd();
$abcd->test();
call_user_func([$abcd,"test"]);
24307-1630335728072334 cli /root/deliverer-main/deliverer/extension/test.php
1630335728072690|0x7ff12cc1e030|(nil)|aaa|/root/deliverer-main/deliverer/extension/test.php|56
1630335728072710|0x7ff12cc1e1a0|0x7ff12cc1e030|bbb|/root/deliverer-main/deliverer/extension/test.php|5
1630335728072712|0x7ff12cc1e220|0x7ff12cc1e1a0|ccc|/root/deliverer-main/deliverer/extension/test.php|9
1630335728072725|0x7ff12cc1e030|(nil)|ddd|/root/deliverer-main/deliverer/extension/test.php|57
1630335728072735|0x7ff12cc1e030|(nil)|abc::test|/root/deliverer-main/deliverer/extension/test.php|60
1630335728072749|0x7ff12cc1e200|0x7fff6976a640|abc::test2|/root/deliverer-main/deliverer/extension/test.php|33
1630335728072762|0x7ff12cc1e270|0x7ff12cc1e200|abcd::test|/root/deliverer-main/deliverer/extension/test.php|28
1630335728072764|0x7ff12cc1e390|0x7fff6976a060|abcd::test2|/root/deliverer-main/deliverer/extension/test.php|52
1630335728072766|0x7ff12cc1e400|0x7ff12cc1e390|abcd::test3|/root/deliverer-main/deliverer/extension/test.php|43
1630335728072772|0x7ff12cc1e030|(nil)|abcd::test|/root/deliverer-main/deliverer/extension/test.php|62
1630335728072773|0x7ff12cc1e200|0x7fff6976a640|abcd::test2|/root/deliverer-main/deliverer/extension/test.php|52
1630335728072774|0x7ff12cc1e270|0x7ff12cc1e200|abcd::test3|/root/deliverer-main/deliverer/extension/test.php|43
1630335728072777|0x7ff12cc1e030|(nil)|abcd::test|/root/deliverer-main/deliverer/extension/test.php|63
1630335728072778|0x7ff12cc1e200|0x7fff6976a640|abcd::test2|/root/deliverer-main/deliverer/extension/test.php|52
1630335728072779|0x7ff12cc1e270|0x7ff12cc1e200|abcd::test3|/root/deliverer-main/deliverer/extension/test.php|43

You can see abcd::test twice by call_user_func , is not the problem, is a callback way, there is a separate stack pop, but because __get is a systematic method, not recorded in the log, so abc::test2 and abcd::test2 can not be found
0x7fff6976a060 parent node.

originally planned to monitor the magic method separately, but after thinking about it, under the single-threaded model, I can directly base it on the timestamp, and just hang it under the function at the previous moment.

https://github.com/zhoumengkang/deliverer/releases/tag/1.1.2


周梦康
9k 声望6.7k 粉丝

退隐江湖