walkor / walkor/GatewayWorker

不能查询到 uid,导致 foreach 遍历了 false值,报错,worker退出

Open
#79 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1k
Forks
291
PR merge metrics
No merged PRs in 30d

Description

![image](https://user-images.githubusercontent.com/18592659/132933950-eec08238-b164-4849-acaa-459be7a565fe.png)

在不停的接收到message时,频繁的通过 Gateway::getUidByClientId($client_id); 查询UID,然而在 lib/Gateway.php 中的 getUidByClientId 方法中,$data 变量返回的值,有可能是这样的:
```
array(1) {
[2130706433]=>
array(1) {
[2000]=>
bool(false)
}
}
```
第三个 foreach 遍历 false 就出错了。
详细的打印记录,可见[error.txt](https://wwa.lanzoui.com/iTbMptv7h6f),false 在 日志中的 18267 行可见

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/Gateway.php at getUidByClientId($client_id), then inspect the third foreach and the logged false value around line 18267 of error.txt. Reproduce the lookup under frequent message traffic and verify that an unexpected false result no longer causes foreach to fail or the worker to exit.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.