Exception: Trying to access array offset on value of type null in /vendor/hprose/hprose/src/Hprose/Client.php:383 的排查分析

1、接口响应:Trying to access array offset on value of type null。如图1

接口响应:Trying to access array offset on value of type null。

图1

2、由于此接口基于 Hprose 请求 RPC 服务端。查看相应的运行日志。Exception: Trying to access array offset on value of type null in /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php:383。如图2

由于此接口基于 Hprose 请求 RPC 服务端。查看相应的运行日志。Exception: Trying to access array offset on value of type null in /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php:383。

图2

2021-01-19 19:01:06 [10.42.22.195][-][-][error][Exception] Exception: Trying to access array offset on value of type null in /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php:383
Stack trace:
#0 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php(477): Hprose/Client->decode('Es51"Trying to ...', Array, Object(stdClass))
#1 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php(489): Hprose/Client->syncInvokeHandler('unBindAccount', Array, Object(stdClass))
#2 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php(103): Hprose/Client->invokeHandler('unBindAccount', Array, Object(stdClass))
#3 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php(608): Hprose/Client->Hprose/{closure}('unBindAccount', Array, Object(stdClass))
#4 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php(438): Hprose/Client->invoke('unBindAccount', Array)
#5 /mcloud/www/channel-pub-api/common/logics/rpc/vtt/VttAppUser.php(77): Hprose/Client->__call('unBindAccount', Array)
#6 /mcloud/www/channel-pub-api/vtt/rests/vtt_app_user/DeleteAction.php(64): common/logics/rpc/vtt/VttAppUser->delete(Array)
#7 [internal function]: vtt/rests/vtt_app_user/DeleteAction->run('46da43905a1911e...')
#8 /mcloud/www/channel-pub-api/vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array)
#9 /mcloud/www/channel-pub-api/vendor/yiisoft/yii2/base/Controller.php(157): yii/base/Action->runWithParams(Array)
#10 /mcloud/www/channel-pub-api/vendor/yiisoft/yii2/base/Module.php(528): yii/base/Controller->runAction('delete', Array)
#11 /mcloud/www/channel-pub-api/vendor/yiisoft/yii2/web/Application.php(103): yii/base/Module->runAction('v1/vtt-app-user...', Array)
#12 /mcloud/www/channel-pub-api/vendor/yiisoft/yii2/base/Application.php(386): yii/web/Application->handleRequest(Object(yii/web/Request))
#13 /mcloud/www/channel-pub-api/vtt/web/index.php(17): yii/base/Application->run()
#14 {main}

3、决定通过打印日志文件的形式排查问题。编辑 /mcloud/www/channel-pub-api/vendor/hprose/hprose/src/Hprose/Client.php

    private function syncInvokeHandler($name, array &$args, stdClass $context) {
        $request = $this->encode($name, $args, $context);
        $beforeFilterHandler = $this->beforeFilterHandler;
        $response = $beforeFilterHandler($request, $context);
        file_put_contents(Yii::getAlias('@runtime') . '/vendor-hprose-hprose-src-Hprose-Client-response-' . microtime(true) . '-' . mt_rand()  . '.txt', print_r($response, true), FILE_APPEND | LOCK_EX);
        file_put_contents(Yii::getAlias('@runtime') . '/vendor-hprose-hprose-src-Hprose-Client-args-' . microtime(true) . '-' . mt_rand()  . '.txt', print_r($args, true), FILE_APPEND | LOCK_EX);
        file_put_contents(Yii::getAlias('@runtime') . '/vendor-hprose-hprose-src-Hprose-Client-context-' . microtime(true) . '-' . mt_rand()  . '.txt', print_r($context, true), FILE_APPEND | LOCK_EX);
        return $this->decode($response, $args, $context);
    }

4、当 RPC 服务端响应成功时,查看文件:vendor-hprose-hprose-src-Hprose-Client-response-1611058217.4824-543667088.txt

Rm3{s4"code"i99999;s7"message"s9"三方平台绑定失败!"s4"data"a{}}z

5、当 RPC 服务端响应成功时,查看文件:vendor-hprose-hprose-src-Hprose-Client-args-1611058217.4831-887085467.txt

Array
(
    [0] => Array
        (
            [password] => b4260bf3006f7563708c1ca4e1c4cb62%2C8c16f7071ded6692c10721d2ac2c2cbf
            [channel_type_code] => vtt_toutiao_pro
            [permission] => 2
            [source_uuid] => 468e5e929edf30f4097ca89168decde9
             => scms
            [account] => 61ffb6b5a2d64dcba10352d765c72908
            [channelCode] => toutiao
            [status] => 1
            [group_id] => 015ce30b116ce86058fa6ab4fea4ac63
            [platform_code] => vtt_toutiao_pro
            [source_system] => scms
            [source_group_id] => 015ce30b116ce86058fa6ab4fea4ac63
            [source_user_token] => 468e5e929edf30f4097ca89168decde9
            [origin_account_uuid] => 4ab9a31c5a4f11eb965d54ee75d2ebc1
        )

)

6、当 RPC 服务端响应成功时,查看文件:vendor-hprose-hprose-src-Hprose-Client-context-1611058217.4836-1374300614.txt

stdClass Object
(
    [client] => Hprose/Http/Client Object
        (
            [host:Hprose/Http/Client:private] => rpc.channel-pub-vtt.localhost
            [path:Hprose/Http/Client:private] => /hprose/index
            [secure:Hprose/Http/Client:private] => 
            [proxy] => 
            [keepAlive] => 1
            [keepAliveTimeout] => 300
            [header:Hprose/Http/Client:private] => Array
                (
                    [Content-type] => application/hprose
                )

            [options:Hprose/Http/Client:private] => Array
                (
                    [64] => 
                    [113] => 1
                    [42] => 1
                    [19913] => 1
                    [47] => 1
                    [99] => 1
                )

            [curl:Hprose/Http/Client:private] => 
            [curlVersionLittleThan720:Hprose/Http/Client:private] => 
            [results:Hprose/Http/Client:private] => Array
                (
                )

            [curls:Hprose/Http/Client:private] => Array
                (
                )

            [contexts:Hprose/Http/Client:private] => Array
                (
                )

            [index:Hprose/Client:private] => 0
            [uriList:Hprose/Client:private] => Array
                (
                    [0] => http://rpc.channel-pub-vtt.localhost/hprose/index
                )

            [async:protected] => 
            [uri] => http://rpc.channel-pub-vtt.localhost/hprose/index
            [filters] => Array
                (
                )

            [timeout] => 30000
            [retry] => 10
            [idempotent] => 
            [failswitch] => 
            [failround] => 0
            [byref] => 
            [simple] => 
            [onError] => 
            [onFailswitch] => 
            [methodCache:Hprose/Client:private] => Array
                (
                )

            [topics:Hprose/Client:private] => 
            [id:Hprose/Client:private] => 
            [invokeHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [beforeFilterHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [afterFilterHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [defaultInvokeHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$name] => <required>
                            [&$args] => <required>
                            [$context] => <required>
                        )

                )

            [defaultBeforeFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [defaultAfterFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [invokeHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$name] => <required>
                            [&$args] => <required>
                            [$context] => <required>
                        )

                )

            [beforeFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [afterFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

        )

    [userdata] => stdClass Object
        (
        )

    [mode] => 0
    [oneway] => 
    [byref] => 
    [simple] => 
    [failswitch] => 
    [idempotent] => 
    [retry] => 10
    [retried] => 0
    [timeout] => 30000
    [httpHeader] => Array
        (
            [Server] => nginx/1.10.1
            [Date] => Tue, 19 Jan 2021 12:10:17 GMT
            [Content-Type] => text/plain;charset=UTF-8
            [Content-Length] => 74
            [Connection] => keep-alive
            [X-Debug-Tag] => 6006cc28c62e9
            [X-Debug-Duration] => 689
            [X-Debug-Link] => /debug/default/view?tag=6006cc28c62e9
        )

)

7、当 RPC 服务端抛出异常时,查看文件:vendor-hprose-hprose-src-Hprose-Client-response-1611058702.7009-1892363890.txt。如图3

当 RPC 服务端抛出异常时,查看文件:vendor-hprose-hprose-src-Hprose-Client-response-1611058702.7009-1892363890.txt

图3

Es51"Trying to access array offset on value of type null"z

8、当 RPC 服务端抛出异常时,查看文件:vendor-hprose-src-Hprose-Client-args-1611058702.7011-780493657.txt。

Array
(
    [0] => Array
        (
            [origin_account_uuid] => 77d007c85a2311eb9df79988cc614e10
        )

)

9、当 RPC 服务端抛出异常时,查看文件:vendor-hprose-hprose-src-Hprose-Client-context-1611058702.7012-1316008257.txt。

stdClass Object
(
    [client] => Hprose/Http/Client Object
        (
            [host:Hprose/Http/Client:private] => vtt1.channel-pub.wjtest.chinamcloud.cn
            [path:Hprose/Http/Client:private] => /hprose/index
            [secure:Hprose/Http/Client:private] =>
            [proxy] =>
            [keepAlive] => 1
            [keepAliveTimeout] => 300
            [header:Hprose/Http/Client:private] => Array
                (
                    [Content-type] => application/hprose
                )

            [options:Hprose/Http/Client:private] => Array
                (
                    [64] =>
                    [113] => 1
                    [42] => 1
                    [19913] => 1
                    [47] => 1
                    [99] => 1
                )

            [curl:Hprose/Http/Client:private] =>
            [curlVersionLittleThan720:Hprose/Http/Client:private] =>
            [results:Hprose/Http/Client:private] => Array
                (
                )

            [curls:Hprose/Http/Client:private] => Array
                (
                )

            [contexts:Hprose/Http/Client:private] => Array
                (
                )

            [index:Hprose/Client:private] => 0
            [uriList:Hprose/Client:private] => Array
                (
                    [0] => http://vtt1.channel-pub.wjtest.chinamcloud.cn/hprose/index
                )

            [async:protected] =>
            [uri] => http://vtt1.channel-pub.wjtest.chinamcloud.cn/hprose/index
            [filters] => Array
                (
                )

            [timeout] => 30000
            [retry] => 10
            [idempotent] =>
            [failswitch] =>
            [failround] => 0
            [byref] =>
            [simple] =>
            [onError] =>
            [onFailswitch] =>
            [methodCache:Hprose/Client:private] => Array
                (
                )

            [topics:Hprose/Client:private] =>
            [id:Hprose/Client:private] =>
            [invokeHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [beforeFilterHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [afterFilterHandlers:Hprose/HandlerManager:private] => Array
                (
                )

            [defaultInvokeHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$name] => <required>
                            [&$args] => <required>
                            [$context] => <required>
                        )

                )

            [defaultBeforeFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [defaultAfterFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [invokeHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$name] => <required>
                            [&$args] => <required>
                            [$context] => <required>
                        )

                )

            [beforeFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

            [afterFilterHandler:protected] => Closure Object
                (
                    [static] => Array
                        (
                            [self] => Hprose/Http/Client Object
 *RECURSION*
                        )

                    [this] => Hprose/Http/Client Object
 *RECURSION*
                    [parameter] => Array
                        (
                            [$request] => <required>
                            [$context] => <required>
                        )

                )

        )

    [userdata] => stdClass Object
        (
        )

    [mode] => 0
    [oneway] =>
    [byref] =>
    [simple] =>
    [failswitch] =>
    [idempotent] =>
    [retry] => 10
    [retried] => 0
    [timeout] => 30000
    [httpHeader] => Array
        (
            [Server] => www.chinamcloud.com
            [Date] => Tue, 19 Jan 2021 12:18:22 GMT
            [Content-Type] => text/plain;charset=UTF-8
            [Content-Length] => 58
        )

)

10、因此,得出结论,这是 RPC 服务端的问题,有待于服务端解决。

原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/181603.html

(0)
上一篇 2021年11月1日
下一篇 2021年11月1日

相关推荐

发表回复

登录后才能评论