alcohol Posted January 23, 2019 Posted January 23, 2019 (edited) Hello , I have a serious problem that needs fixing but it's hard because it is a problem without any error in my gamserver console. So, many times (random) when a character (tested with mage if that makes any sense) kills mobs , he gets stucked. What that means? He can see mobs moving and other characters. He can't write anything or do any action. Other players can see him (or kill him,etc). The only way to unstuck is CTRL+ALT+DELETE. No errors on gameserver , that's the worst. version: 368 Any help please , to what can be the problem? Edited January 23, 2019 by alcohol Quote
0 melron Posted January 23, 2019 Posted January 23, 2019 when the player does NOT stuck, the drops when killing that mob, do they have some delay? Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 6 minutes ago, melron said: when the player does NOT stuck, the drops when killing that mob, do they have some delay? Just checked it and no it's normal , immediately loot normal. It is so strange and important as well. The bad is that I cannot test it because I don't even know when will I stuck , itslike random. I tried a "debugging" now to see if character is movementDisabled or null , but I don't think so. I try everything , cant' come with a solution :( Quote
0 melron Posted January 23, 2019 Posted January 23, 2019 (edited) Try to open ur server in a different pc and tell me what will happen. You got a similar prob like one guy had today. Its like packet loss thing but you have to test it Edited January 23, 2019 by melron Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 1 minute ago, melron said: Try to open ur server in a different pc and tell me what will happen. You got a similar prob like one guy had today. Its like packet loss thing but you have to test it Server is hosted on VPS machine with excellent connection speed , so this is not the problem. So it is already on different computer. It was from the beginning. Packet loss yes maybe(?) but how can I test this to see wtf is going on? Quote
0 melron Posted January 23, 2019 Posted January 23, 2019 i didnt say anything related to connection speed. Can you check what i told you? just open your server from your pc . not ur vps. Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 3 minutes ago, melron said: i didnt say anything related to connection speed. Can you check what i told you? just open your server from your pc . not ur vps. Ok i am going to do it now and I will give a feedback. What should I see? if problem is happening (or not) in localhost? Quote
0 melron Posted January 23, 2019 Posted January 23, 2019 Just now, alcohol said: Ok i am going to do it now and I will give a feedback. What should I see? if problem is happening (or not) in localhost? exactly Quote
0 wongerlt Posted January 23, 2019 Posted January 23, 2019 maybe somewhere infinite loop, try debug with l2phx on what packet it stuck. Quote
0 Tryskell Posted January 23, 2019 Posted January 23, 2019 (edited) You can try to dump ClientStats. I'm interested by your results. Do that on a saved project in order to be able to revert it. You can also tweak MMO values under Config.java, search for keyword "hidden". Edit whatever based on packets count, until you find some good values. ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/network/ClientStats.java =================================================================== --- java/net/sf/l2j/gameserver/network/ClientStats.java (revision 1055) +++ java/net/sf/l2j/gameserver/network/ClientStats.java (nonexistent) @@ -1,212 +0,0 @@ -package net.sf.l2j.gameserver.network; - -import net.sf.l2j.Config; - -public class ClientStats -{ - public int processedPackets = 0; - public int droppedPackets = 0; - public int unknownPackets = 0; - public int totalQueueSize = 0; - public int maxQueueSize = 0; - public int totalBursts = 0; - public int maxBurstSize = 0; - public int shortFloods = 0; - public int longFloods = 0; - public int totalQueueOverflows = 0; - public int totalUnderflowExceptions = 0; - - private final int[] _packetsInSecond; - private long _packetCountStartTick = 0; - private int _head; - private int _totalCount = 0; - - private int _floodsInMin = 0; - private long _floodStartTick = 0; - private int _unknownPacketsInMin = 0; - private long _unknownPacketStartTick = 0; - private int _overflowsInMin = 0; - private long _overflowStartTick = 0; - private int _underflowReadsInMin = 0; - private long _underflowReadStartTick = 0; - - private volatile boolean _floodDetected = false; - private volatile boolean _queueOverflowDetected = false; - - private final int BUFFER_SIZE; - - public ClientStats() - { - BUFFER_SIZE = Config.CLIENT_PACKET_QUEUE_MEASURE_INTERVAL; - _packetsInSecond = new int[BUFFER_SIZE]; - _head = BUFFER_SIZE - 1; - } - - /** - * @return true if incoming packet need to be dropped. - */ - protected final boolean dropPacket() - { - final boolean result = _floodDetected || _queueOverflowDetected; - if (result) - droppedPackets++; - return result; - } - - /** - * @param queueSize - * @return true if flood detected first and ActionFailed packet need to be sent. Later during flood returns true (and send ActionFailed) once per second. - */ - protected final boolean countPacket(int queueSize) - { - processedPackets++; - totalQueueSize += queueSize; - if (maxQueueSize < queueSize) - maxQueueSize = queueSize; - if (_queueOverflowDetected && queueSize < 2) - _queueOverflowDetected = false; - - return countPacket(); - } - - /** - * Counts unknown packets. - * @return true if threshold is reached. - */ - protected final boolean countUnknownPacket() - { - unknownPackets++; - - final long tick = System.currentTimeMillis(); - if (tick - _unknownPacketStartTick > 60000) - { - _unknownPacketStartTick = tick; - _unknownPacketsInMin = 1; - return false; - } - - _unknownPacketsInMin++; - return _unknownPacketsInMin > Config.CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN; - } - - /** - * Counts burst length. - * @param count - current number of processed packets in burst - * @return true if execution of the queue need to be aborted. - */ - protected final boolean countBurst(int count) - { - if (count > maxBurstSize) - maxBurstSize = count; - - if (count < Config.CLIENT_PACKET_QUEUE_MAX_BURST_SIZE) - return false; - - totalBursts++; - return true; - } - - /** - * Counts queue overflows. - * @return true if threshold is reached. - */ - protected final boolean countQueueOverflow() - { - _queueOverflowDetected = true; - totalQueueOverflows++; - - final long tick = System.currentTimeMillis(); - if (tick - _overflowStartTick > 60000) - { - _overflowStartTick = tick; - _overflowsInMin = 1; - return false; - } - - _overflowsInMin++; - return _overflowsInMin > Config.CLIENT_PACKET_QUEUE_MAX_OVERFLOWS_PER_MIN; - } - - /** - * Counts underflow exceptions. - * @return true if threshold is reached. - */ - protected final boolean countUnderflowException() - { - totalUnderflowExceptions++; - - final long tick = System.currentTimeMillis(); - if (tick - _underflowReadStartTick > 60000) - { - _underflowReadStartTick = tick; - _underflowReadsInMin = 1; - return false; - } - - _underflowReadsInMin++; - return _underflowReadsInMin > Config.CLIENT_PACKET_QUEUE_MAX_UNDERFLOWS_PER_MIN; - } - - /** - * @return true if maximum number of floods per minute is reached. - */ - protected final boolean countFloods() - { - return _floodsInMin > Config.CLIENT_PACKET_QUEUE_MAX_FLOODS_PER_MIN; - } - - private final boolean longFloodDetected() - { - return (_totalCount / BUFFER_SIZE) > Config.CLIENT_PACKET_QUEUE_MAX_AVERAGE_PACKETS_PER_SECOND; - } - - /** - * @return true if flood detected first and ActionFailed packet need to be sent. Later during flood returns true (and send ActionFailed) once per second. - */ - private final synchronized boolean countPacket() - { - _totalCount++; - final long tick = System.currentTimeMillis(); - if (tick - _packetCountStartTick > 1000) - { - _packetCountStartTick = tick; - - // clear flag if no more flooding during last seconds - if (_floodDetected && !longFloodDetected() && _packetsInSecond[_head] < Config.CLIENT_PACKET_QUEUE_MAX_PACKETS_PER_SECOND / 2) - _floodDetected = false; - - // wrap head of the buffer around the tail - if (_head <= 0) - _head = BUFFER_SIZE; - _head--; - - _totalCount -= _packetsInSecond[_head]; - _packetsInSecond[_head] = 1; - return _floodDetected; - } - - final int count = ++_packetsInSecond[_head]; - if (!_floodDetected) - { - if (count > Config.CLIENT_PACKET_QUEUE_MAX_PACKETS_PER_SECOND) - shortFloods++; - else if (longFloodDetected()) - longFloods++; - else - return false; - - _floodDetected = true; - if (tick - _floodStartTick > 60000) - { - _floodStartTick = tick; - _floodsInMin = 1; - } - else - _floodsInMin++; - - return true; // Return true only in the beginning of the flood - } - - return false; - } -} \ No newline at end of file Index: java/net/sf/l2j/gameserver/network/L2GameClient.java =================================================================== --- java/net/sf/l2j/gameserver/network/L2GameClient.java (revision 1055) +++ java/net/sf/l2j/gameserver/network/L2GameClient.java (working copy) @@ -67,7 +67,6 @@ protected ScheduledFuture<?> _cleanupTask = null; public GameCrypt _crypt; - private final ClientStats _stats; private boolean _isDetached = false; @@ -80,7 +79,6 @@ _state = GameClientState.CONNECTED; _connectionStartTime = System.currentTimeMillis(); _crypt = new GameCrypt(); - _stats = new ClientStats(); _packetQueue = new ArrayBlockingQueue<>(Config.CLIENT_PACKET_QUEUE_SIZE); _autoSaveInDB = ThreadPool.scheduleAtFixedRate(new AutoSaveTask(), 300000L, 900000L); @@ -107,11 +105,6 @@ } } - public ClientStats getStats() - { - return _stats; - } - public long getConnectionStartTime() { return _connectionStartTime; @@ -635,17 +628,7 @@ */ public boolean dropPacket() { - if (_isDetached) // detached clients can't receive any packets - return true; - - // flood protection - if (getStats().countPacket(_packetQueue.size())) - { - sendPacket(ActionFailed.STATIC_PACKET); - return true; - } - - return getStats().dropPacket(); + return _isDetached; } /** @@ -653,12 +636,6 @@ */ public void onBufferUnderflow() { - if (getStats().countUnderflowException()) - { - _log.severe("Client " + toString() + " - Disconnected: Too many buffer underflow exceptions."); - closeNow(); - return; - } if (_state == GameClientState.CONNECTED) // in CONNECTED state kick client immediately { if (Config.PACKET_HANDLER_DEBUG) @@ -672,12 +649,6 @@ */ public void onUnknownPacket() { - if (getStats().countUnknownPacket()) - { - _log.severe("Client " + toString() + " - Disconnected: Too many unknown packets."); - closeNow(); - return; - } if (_state == GameClientState.CONNECTED) // in CONNECTED state kick client immediately { if (Config.PACKET_HANDLER_DEBUG) @@ -692,45 +663,16 @@ */ public void execute(ReceivablePacket<L2GameClient> packet) { - if (getStats().countFloods()) - { - _log.severe("Client " + toString() + " - Disconnected, too many floods:" + getStats().longFloods + " long and " + getStats().shortFloods + " short."); - closeNow(); - return; - } - if (!_packetQueue.offer(packet)) { - if (getStats().countQueueOverflow()) - { - _log.severe("Client " + toString() + " - Disconnected, too many queue overflows."); - closeNow(); - } - else - sendPacket(ActionFailed.STATIC_PACKET); - + sendPacket(ActionFailed.STATIC_PACKET); return; } if (_queueLock.isLocked()) // already processing return; - try - { - if (_state == GameClientState.CONNECTED && getStats().processedPackets > 3) - { - if (Config.PACKET_HANDLER_DEBUG) - _log.severe("Client " + toString() + " - Disconnected, too many packets in non-authed state."); - - closeNow(); - return; - } - - ThreadPool.execute(this); - } - catch (RejectedExecutionException e) - { - } + ThreadPool.execute(this); } @Override @@ -741,7 +683,6 @@ try { - int count = 0; ReceivablePacket<L2GameClient> packet; while (true) { @@ -763,10 +704,6 @@ { _log.severe("Exception during execution " + packet.getClass().getSimpleName() + ", client: " + toString() + "," + e.getMessage()); } - - count++; - if (getStats().countBurst(count)) - return; } } finally Edited January 23, 2019 by Tryskell Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 1 hour ago, melron said: Try to open ur server in a different pc and tell me what will happen. You got a similar prob like one guy had today. Its like packet loss thing but you have to test it I hit mobs in localhost more than 15 minutes and nothing happened. Propably it's ok on local (even i am not sure, its so hard ) @Tryskell should i test it local , vps or it doesnt matter? what should i see? PS: maybe movement is a part of this bug? because a friend stucked without even hitting a mob before some minutes. random stuck while running. (same bug , ctrl+alt+delete only way to exit) Quote
0 Tryskell Posted January 23, 2019 Posted January 23, 2019 (edited) If things like chatting, playing with inventory items and other actions are frozen, it simply means packets are dropped, in one way or another (being client, or packets of the client). Got nothing related to movement. Edited January 23, 2019 by Tryskell Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 6 minutes ago, Tryskell said: If things like chatting, playing with inventory items and other actions are frozen, it simply means packets are dropped, in one way or another (being client, or packets of the client). Got nothing related to movement. Okay it is just strange because some stucks happened when even not hitting mobs. What are the reccomendations for fixing the problem? (completely) Quote
0 Tryskell Posted January 23, 2019 Posted January 23, 2019 (edited) 29 minutes ago, alcohol said: Okay it is just strange because some stucks happened when even not hitting mobs. What are the reccomendations for fixing the problem? (completely) - Don't use a customized pack, or review whatever you added. I'm not Harry Potter (even if I got black glasses and a scar on the fronthead IRL) and can't help you if you edited stuff. - Don't use any Guard-like, they are mostly shitty. - Drop ClientStats or tweak hidden Config related to MMOCore / ClientStats (see my previous post). Nothing more. You can eventually test your pack on another OS environment to exclude Linux / Windows. Edited January 23, 2019 by Tryskell Quote
0 alcohol Posted January 23, 2019 Author Posted January 23, 2019 4 minutes ago, Tryskell said: - Don't use a customized pack, or review whatever you added. I'm not Harry Potter (even if I got black glasses and a scar on the fronthead IRL) and can't help you if you edited stuff. - Don't use any Guard-like, they are mostly shitty. - Drop ClientStats or tweak hidden Config related to MMOCore / ClientStats (see my previous post). Nothing more. You can eventually test your pack on another OS environment to exclude Linux / Windows. -Nothing custom yet , ONLY 2 mobs npcs xml. -not using any guard now. -Droping ClientStats will have any negative effect? Will it make the problem dissapear? Quote
0 alcohol Posted January 25, 2019 Author Posted January 25, 2019 Does completely removing ClientStats has a negative effect? if yes, what's that? Quote
Question
alcohol
Hello , I have a serious problem that needs fixing but it's hard because it is a problem without any error in my gamserver console.
So, many times (random) when a character (tested with mage if that makes any sense) kills mobs , he gets stucked.
What that means?
He can see mobs moving and other characters. He can't write anything or do any action. Other players can see him (or kill him,etc).
The only way to unstuck is CTRL+ALT+DELETE.
No errors on gameserver , that's the worst.
version: 368
Any help please , to what can be the problem?
Edited by alcohol16 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.