Code Monkey home page Code Monkey logo

imgamer / kbengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acatadog/kbengine

25.0 25.0 6.0 331.29 MB

这是 KBEngine 的 kst 分支,用于开发大型 MMORPG 游戏。根据实际的项目开发需要对 KBEngine 的特性进行扩展,例如飞行平台功能。并依托项目对 KBEngine 进行有针对性的深度压力测试,通过压测,得到KBEngine服务器的性能极限数据,得到了与运营有关的服务器优化配置参数,发现并修正了多项在正常情况下难以发现或重现的幽灵bug。

Home Page: http://www.kbengine.org

License: GNU Lesser General Public License v3.0

Batchfile 0.14% Shell 2.27% Python 24.09% CSS 0.11% Roff 1.97% PLSQL 0.02% HTML 2.75% PowerShell 0.01% Makefile 5.03% C++ 10.66% CMake 0.19% C 45.04% M4 1.01% Perl 3.34% Inno Setup 0.01% Awk 0.01% Module Management System 0.01% XSLT 0.01% Java 0.01% JavaScript 3.35%

kbengine's People

Contributors

10406201 avatar 1958 avatar basesrv avatar bitdeli-chef avatar bydreamxxx avatar caodhuan avatar chenweilan avatar finchcn avatar gamegrd avatar helloeveroneday avatar imgamer avatar jay602 avatar jyunfan2015 avatar kbengine avatar kbenginegmx avatar kebiao avatar klights avatar liudaafang avatar mssk12315 avatar qiurunan avatar rmdevilmay avatar ruleless avatar sdayu avatar sersoong avatar shufengw avatar srvbots avatar u3dkbe avatar worldg avatar yelei8363 avatar zhuyeaini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kbengine's Issues

dbmgr automatically exits itself after some time with "mongodb" enabled

[ INFO] [0x00001718] [2019-08-28 11:35:39,902] Components::removeComponentByChannel: dbmgr : 4002, Normal exit!
WARNING baseappmgr-1 13061 5002 [2019-08-28 11:35:39 901] - TCPPacketReceiver::processPendingEvents(192.168.1.7:1845): Throwing REASON_GENERAL_NETWORK - WSAECONNRESET
ERROR baseappmgr-1 13061 5002 [2019-08-28 11:35:39 903] - Components::removeComponentByChannel: dbmgr : 4002, Abnormal exit! TCPPacketReceiver::processRecv(): errno=10054

moveToPoint的使用导致服务器崩溃(KBEN-142)

master版本:SHA-1: f1d08f9
使用release模式发布,调用moveToPoint参数传入错误导致服务器崩溃

重现方式:
windows下使用模式release发布的kbe cellapp,在moveToPoint的在moveVertically(贴地)参数传入一个python列表,时会崩溃

使用debug发布的cellapp则报出如下错误:
TypeError: KBEngine::Entity::__py_pyMoveToPoint: args(float, float, PyObject_ptr, int32, int32, ���() is error!

创建space时,未指定cellappIndex时有可能创建在不参与负载均衡的cellapp中(KBEN-141)

@kebiao

问题描述:
2个cellapp,一开始设置不参与动态负载平衡->不指定cellapp请求创建space(没有可用cellapp于是缓存请求消息)->再修改第2个的标记为参与->会把space创建到第一个还没解除不参与标记的cellapp。

问题原因:
缓存space创建消息后,一旦有cellapp准备好,就立刻创建space到第一个找到的cellapp,不管是否它是否参与动态负载平衡。
baseapp应该也存在类似问题。

bug代码在:
bool ForwardAnywhere_MessageBuffer::process(),选择cellapp相关代码。

智能指针导致的服务器组件崩溃问题

Program terminated with signal 11, Segmentation fault.
#0 0x00000000007c2438 in KBEngine::Navigation::findNavigation (this=0x11010c0, resPath=...) at navigation.cpp:79
79	navigation.cpp: No such file or directory.
in navigation.cpp
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6.x86_64 libgcc-4.4.7-23.el6.x86_64 libstdc++-4.4.7-23.el6.x86_64
(gdb) bt
#0 0x00000000007c2438 in KBEngine::Navigation::findNavigation (this=0x11010c0, resPath="space\\L_BJG_NAVMESH") at navigation.cpp:79
#1 0x00000000006b0125 in KBEngine::LoadNavmeshTask::presentMainThread (this=0x7ff64551c8c0) at loadnavmesh_threadtasks.cpp:40
#2 0x00000000007e0d48 in KBEngine::thread::ThreadPool::onMainThreadTick (this=0x7ffc7c0dd898) at threadpool.cpp:375
#3 0x0000000000656f71 in handleGameTick (this=0x7ffc7c0dd7d0) at /home/kenner/kbe/kbengine/kbe/src/lib/server/entity_app.h:760
#4 KBEngine::Cellapp::handleGameTick (this=0x7ffc7c0dd7d0) at cellapp.cpp:270
#5 0x0000000000653d12 in handleTimeout (this=0x7ffc7c0dd7d0, handle=<value optimized out>, arg=<value optimized out>) at /home/kenner/kbe/kbengine/kbe/src/lib/server/entity_app.h:744
#6 KBEngine::Cellapp::handleTimeout (this=0x7ffc7c0dd7d0, handle=<value optimized out>, arg=<value optimized out>) at cellapp.cpp:259
#7 0x000000000079a139 in triggerTimer (this=0x7ff6639e4fd0, now=5851500305038706) at /home/kenner/kbe/kbengine/kbe/src/lib/common/timer.inl:267
#8 KBEngine::TimersT<unsigned long>::process (this=0x7ff6639e4fd0, now=5851500305038706) at /home/kenner/kbe/kbengine/kbe/src/lib/common/timer.inl:139
#9 0x0000000000799662 in KBEngine::Network::EventDispatcher::processTimers (this=0x7ffc7c0de150) at event_dispatcher.cpp:172
#10 0x0000000000799833 in KBEngine::Network::EventDispatcher::processOnce (this=0x7ffc7c0de150, shouldIdle=true) at event_dispatcher.cpp:215
#11 0x000000000079989d in KBEngine::Network::EventDispatcher::processUntilBreak (this=0x7ffc7c0de150) at event_dispatcher.cpp:202
#12 0x0000000000749fed in KBEngine::ServerApp::run (this=<value optimized out>) at serverapp.cpp:277
#13 0x00000000006d907f in KBEngine::kbeMainT<KBEngine::Cellapp> (argc=<value optimized out>, argv=<value optimized out>, componentType=KBEngine::CELLAPP_TYPE, extlisteningPort_min=17174880, extlisteningPort_max=12649664, 
    extlisteningInterface=0x7ffc7c0de310 "XZ5W\366\177", intlisteningPort=0, intlisteningInterface=0x10fc136 "") at /home/kenner/kbe/kbengine/kbe/src/lib/server/kbemain.h:193
#14 0x00000000006c394f in kbeMain (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:79
#15 0x00000000006c3ae1 in main (argc=3, argv=0x7ffc7c0de548) at main.cpp:76

重现方法:
cs3项目,aiPer中TeleportSpaceAI设置为100,将teleport_maps中bigmap_1和L_JYHD对应的最后一项设置为True,其他都设置为False,起机器人进行测试,一段时间即可重现问题。

启动过多的cellapp进程后,有些cellapp会在启动时崩溃

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64 libgcc-4.4.7-17.el6.x86_64 libstdc++-4.4.7-17.el6.x86_64 
(gdb) bt 
#0 0x0000003a2dc325e5 in raise () from /lib64/libc.so.6 
#1 0x0000003a2dc33dc5 in abort () from /lib64/libc.so.6 
#2 0x00000000007ff587 in KBEngine::myassert (exp=0xbf49b8 "ret != -1", func=0xbf8e20 "onGetEntityAppFromDbmgr", file=0xbf4928 "cellapp.cpp", line=407) at debug_helper.cpp:145 
#3 0x0000000000659857 in KBEngine::Cellapp::onGetEntityAppFromDbmgr (this=0x7fff3abd7780, pChannel=0x7f885697cb00, uid=2000, username="kbe", componentType=KBEngine::CELLAPP_TYPE, componentID=<value optimized out>, globalorderID=41, 
    grouporderID=26, intaddr=4043706540, intport=30825, extaddr=0, extport=0, extaddrEx="") at cellapp.cpp:407 
#4 0x0000000000675bcb in KBEngine::CellappInterface::onGetEntityAppFromDbmgrCellappMessagehandler11::handle (this=<value optimized out>, pChannel=0x7f885697cb00, s=...) at cellapp_interface.h:75 
#5 0x00000000007a5ecf in KBEngine::Network::PacketReader::processMessages (this=0x7f8868c89140, pMsgHandlers=0x1101300, pPacket=0x7f8856d967e0) at packet_reader.cpp:207 
#6 0x0000000000796d31 in KBEngine::Network::Channel::processPackets (this=0x7f885697cb00, pMsgHandlers=0x1101300, pPacket=0x7f8856d967e0) at channel.cpp:811 
#7 0x00000000007975b6 in KBEngine::Network::Channel::addReceiveWindow (this=0x7f885697cb00, pPacket=0x7f8856d967e0) at channel.cpp:713 
#8 0x00000000007ae634 in KBEngine::Network::TCPPacketReceiver::processFilteredPacket (this=<value optimized out>, pChannel=<value optimized out>, pPacket=<value optimized out>) at tcp_packet_receiver.cpp:145 
#9 0x00000000007b011f in KBEngine::Network::TCPPacketReceiver::processRecv (this=0x7f8856727200, expectingPacket=true) at tcp_packet_receiver.cpp:122 
#10 0x00000000007c17af in KBEngine::Network::PacketReceiver::handleInputNotification (this=0x7f8856727200, fd=<value optimized out>) at packet_receiver.cpp:63 
#11 0x000000000079a3aa in KBEngine::Network::EventPoller::triggerRead (this=<value optimized out>, fd=<value optimized out>) at event_poller.cpp:102 
#12 0x00000000007a7d7c in KBEngine::Network::EpollPoller::processPendingEvents (this=0x7f887310e800, maxWait=<value optimized out>) at poller_epoll.cpp:141 
#13 0x000000000079989d in KBEngine::Network::EventDispatcher::processUntilBreak (this=0x7fff3abd8100) at event_dispatcher.cpp:202 
#14 0x0000000000749fed in KBEngine::ServerApp::run (this=<value optimized out>) at serverapp.cpp:277 
#15 0x00000000006d907f in KBEngine::kbeMainT<KBEngine::Cellapp> (argc=<value optimized out>, argv=<value optimized out>, componentType=KBEngine::CELLAPP_TYPE, extlisteningPort_min=17174880, extlisteningPort_max=12649664, 
    extlisteningInterface=0x7fff3abd82c0 "\230\316=V\210\177", intlisteningPort=0, intlisteningInterface=0x10fc136 "") at /home/kenner/kbe/kbengine/kbe/src/lib/server/kbemain.h:193 
#16 0x00000000006c394f in kbeMain (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:79 
#17 0x00000000006c3ae1 in main (argc=3, argv=0x7fff3abd84f8) at main.cpp:76

跨服副本的支持

通过center组件,是否能达到跨服打副本的效果?
不同服的玩家可以传送到一个副本,组队完成副本。 @imgamer

机器人压测导致baseapp崩溃2019-4-10(KBEN-152)

Program terminated with signal 6, Aborted. 
#0 0x00007fb89e6794f5 in raise () from /lib64/libc.so.6 
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6.x86_64 libgcc-4.4.7-23.el6.x86_64 libstdc++-4.4.7-23.el6.x86_64 zlib-1.2.3-29.el6.x86_64 
(gdb) bt 
#0 0x00007fb89e6794f5 in raise () from /lib64/libc.so.6 
#1 0x00007fb89e67acd5 in abort () from /lib64/libc.so.6 
#2 0x00000000007b82f7 in KBEngine::myassert (exp=0xbaf200 "!pBufferedSendToClientMessages_", func=0xbafe00 "onMigrationCellappEnd", file=0xbae7d1 "entity.cpp", line=1587) at debug_helper.cpp:145 
#3 0x00000000006417db in KBEngine::Entity::onMigrationCellappEnd (this=0x7fb88b42fcf8, pChannel=<value optimized out>, sourceCellAppID=13000000000002, targetCellAppID=1000000000002) at entity.cpp:1587 
#4 0x00000000006813fd in KBEngine::BaseappInterface::onMigrationCellappEndEntityMessagehandler2::handle (this=<value optimized out>, pChannel=0x7fb89e29bc00, s=...) at baseapp_interface.h:357 
#5 0x000000000077a4cf in KBEngine::Network::PacketReader::processMessages (this=0x7fb892f20000, pMsgHandlers=0x10a4e80, pPacket=0x7fb89471be90) at packet_reader.cpp:207 
#6 0x0000000000766c21 in KBEngine::Network::Channel::processPackets (this=0x7fb89e29bc00, pMsgHandlers=0x10a4e80, pPacket=0x7fb89471be90) at channel.cpp:811 
#7 0x00000000007674a6 in KBEngine::Network::Channel::addReceiveWindow (this=0x7fb89e29bc00, pPacket=0x7fb89471be90) at channel.cpp:713 
#8 0x0000000000782c34 in KBEngine::Network::TCPPacketReceiver::processFilteredPacket (this=<value optimized out>, pChannel=<value optimized out>, pPacket=<value optimized out>) at tcp_packet_receiver.cpp:145 
#9 0x000000000078471f in KBEngine::Network::TCPPacketReceiver::processRecv (this=0x7fb8938f7f40, expectingPacket=true) at tcp_packet_receiver.cpp:122 
#10 0x0000000000796aff in KBEngine::Network::PacketReceiver::handleInputNotification (this=0x7fb8938f7f40, fd=<value optimized out>) at packet_receiver.cpp:63 
#11 0x000000000076a29a in KBEngine::Network::EventPoller::triggerRead (this=<value optimized out>, fd=<value optimized out>) at event_poller.cpp:102 
#12 0x000000000077c37c in KBEngine::Network::EpollPoller::processPendingEvents (this=0x7fb89e284800, maxWait=<value optimized out>) at poller_epoll.cpp:141 
#13 0x000000000076978d in KBEngine::Network::EventDispatcher::processUntilBreak (this=0x7ffc1edd1ca0) at event_dispatcher.cpp:202 
#14 0x00000000006e79fd in KBEngine::ServerApp::run (this=<value optimized out>) at serverapp.cpp:277 
#15 0x00000000006c417f in KBEngine::kbeMainT<KBEngine::Baseapp> (argc=<value optimized out>, argv=<value optimized out>, componentType=KBEngine::BASEAPP_TYPE, extlisteningPort_min=16801856, extlisteningPort_max=12354528, 
    extlisteningInterface=0x7ffc1edd1e60 "?207^\223?\177", intlisteningPort=0, intlisteningInterface=0x10a02de "") at /home/kenner/kbe/kbengine/kbe/src/lib/server/kbemain.h:193 
#16 0x00000000006b08e4 in kbeMain (argc=<value optimized out>, argv=<value optimized out>) at main.cpp:81 
#17 0x00000000006b0a71 in main (argc=3, argv=0x7ffc1edd2098) at main.cpp:77 
(gdb)

bot entity创建时的dbid递增bug

image

见中红框选中部分,一般而言,entity的的dbid是由低到高递增,然而数据库中显示bot entity的dbid是一个比较大的值,查看代码以确定是否正常。

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

明确问题:

机器人刷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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.