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
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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
1 2 3 4 5 6 7 8 9 | 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
1 | Rm3{s4"code"i99999;s7"message"s9"三方平台绑定失败!"s4"data"a{}}z |
5、当 RPC 服务端响应成功时,查看文件:vendor-hprose-hprose-src-Hprose-Client-args-1611058217.4831-887085467.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Array ( [0] => Array ( [password] => b4260bf3006f7563708c1ca4e1c4cb62%2C8c16f7071ded6692c10721d2ac2c2cbf [channel_type_code] => vtt_toutiao_pro [permission] => 2 [source_uuid] => 468e5e929edf30f4097ca89168decde9 [source] => 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 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 ( ) [async:protected] => [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
1 | Es51"Trying to access array offset on value of type null"z |
8、当 RPC 服务端抛出异常时,查看文件:vendor-hprose-src-Hprose-Client-args-1611058702.7011-780493657.txt。
1 2 3 4 5 6 7 8 | Array ( [0] => Array ( [origin_account_uuid] => 77d007c85a2311eb9df79988cc614e10 ) ) |
9、当 RPC 服务端抛出异常时,查看文件:vendor-hprose-hprose-src-Hprose-Client-context-1611058702.7012-1316008257.txt。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | 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 ( ) [async:protected] => [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 服务端的问题,有待于服务端解决。
近期评论