Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

广播的entity属性数据过大时导致 bundle 包长度计算错误 #6

Closed
imgamer opened this issue Jun 27, 2019 · 1 comment
Closed

Comments

@imgamer
Copy link
Owner

imgamer commented Jun 27, 2019

明确问题:

机器人刷demo战boss副本,战斗一段时间后,cellapp崩溃。

玩家有一个attrBuffs的属性是ALL_CLIENTS,每次发生变化的时候都会广播给周边的玩家,这个属性在玩家战斗的过程中变得越来越庞大(在测试中,有发现达到1000个以上的buff数据),这么庞大的数据在广播的过程中,引起socket异常,从而导致进程通信中断。

在出现问题之前,log日志中可以看到
WARN root [0x00001360] [2018-11-16 09:29:31,041] - EventHistoryStats::trackEvent[Role.attrBuffs]: message size(13697) >= PACKET_MAX_SIZE_TCP(1460).之类的警告信息。

定位问题:

通过错误信息可以看到是某个 msgid 找不到对应协议导致的问题。
开启配置中的 <trace_packet>/<debug_type> 1
可以在日志中看到 bundle 信息(id,length)的输出,可以看到异常的 msgid ,这是一个不可能的值,猜测是协议解析出错,msgid 的解析越界了,msgid 和 length 等数据写入和读取不匹配了。

解决问题:

阅读相关代码,找到bug并修正。引擎代码存在bug,广播( cell_public )的entity属性数据过大时(messageLength >= NETWORK_MESSAGE_MAX_SIZE)导致 bundle 包长度计算错误。

fixed at: d2153b5

@imgamer imgamer closed this as completed Jun 27, 2019
@imgamer
Copy link
Owner Author

imgamer commented Jun 27, 2019

内网见 KBEN-138

imgamer added a commit that referenced this issue Jul 1, 2019
#0  0x00007f5d3681a4f5 in raise () from /lib64/libc.so.6
#1  0x00007f5d3681bcd5 in abort () from /lib64/libc.so.6
#2  0x00007f5d3681366e in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007f5d36813730 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000007c1de1 in decRef (this=0x11010c0) at /home/kbe/kbengine/kbe/src/lib/common/refcountable.h:65
#5  decrementReferenceCount<KBEngine::NavigationHandle> (this=0x11010c0) at /home/kbe/kbengine/kbe/src/lib/common/smartpointer.h:37
#6  ~ConstSmartPointer (this=0x11010c0) at /home/kbe/kbengine/kbe/src/lib/common/smartpointer.h:68
#7  ~SmartPointer (this=0x11010c0) at /home/kbe/kbengine/kbe/src/lib/common/smartpointer.h:214
#8  ~pair (this=0x11010c0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c  /4.4.7/bits/stl_pair.h:68
kbengine#9  destroy (this=0x11010c0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c  /4.4.7/ext/new_allocator.h:115
#10 _M_deallocate_node (this=0x11010c0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c  /4.4.7/tr1_impl/hashtable:509
kbengine#11 _M_deallocate_nodes (this=0x11010c0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c  /4.4.7/tr1_impl/hashtable:530
kbengine#12 clear (this=0x11010c0) at /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c  /4.4.7/tr1_impl/hashtable:1209
kbengine#13 KBEngine::Navigation::finalise (this=0x11010c0) at navigation.cpp:49
kbengine#14 0x0000000000656591 in KBEngine::Cellapp::finalise (this=0x7ffdc0afb260) at cellapp.cpp:327
kbengine#15 0x00000000006d90a5 in KBEngine::kbeMainT<KBEngine::Cellapp> (argc=<value optimized out>, argv=<value optimized out>, componentType=KBEngine::CELLAPP_TYPE, extlisteningPort_min=17174880, extlisteningPort_max=12649664,
    extlisteningInterface=0x7ffdc0afbd01 "\223@6]\177", intlisteningPort=0, intlisteningInterface=0x10fc136 "") at /home/kbe/kbengine/kbe/src/lib/server/kbemain.h:196
kbengine#16 0x00000000006c394f in kbeMain (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:79
kbengine#17 0x00000000006c3ae1 in main (argc=3, argv=0x7ffdc0afbfd8) at main.cpp:76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant