Trophonix / TradePlus

Easy-to-use, highly configurable trading plugin for Spigot- and Bukkit-based Minecraft servers.
https://www.spigotmc.org/resources/23138/
GNU General Public License v3.0
54 stars 42 forks source link

10-20 seconds of lag cause by trade #62

Closed afoxxvi closed 11 months ago

afoxxvi commented 3 years ago

This happens when two player begin to trade. And then server stopped responding for several seconds, sometimes can up to 30s. I don't think it's tolerable, this lag totally destroyed my game experience. I believe slow Internet caused this, because my monitor plugin warned that TradePlus is connecting Internet on server main thread. And here is console log. https://pastebin.com/g0ET4BJn Please fix it, thanks

CW-UK commented 3 years ago

Can also confirm this issue. Massive lag spikes that drop the server to 12 TPS, when it runs at 20 consistently. Have had to rollback to 3.74

image

leviem1 commented 3 years ago

Seems to be correlated to #60 (at least for @CW-UK) since this is happening during the log save task from what I can tell. Though, I notice it after a trade is completed.

afoxxvi commented 3 years ago

Seems to be correlated to #60 (at least for @CW-UK) since this is happening during the log save task from what I can tell. Though, I notice it after a trade is completed.

However in version 3.79.1 this problem still exists. And the thread dump is totally same as before, caused by the plugin's network in main thread. @Trophonix Could please have a look at this? This's really a very severe problem.

afoxxvi commented 3 years ago

I guess by changing com.trophonix.tradeplus.util.InvUtils line 59 inv.setItem( pl.getTradeConfig().getAcceptSlot(), ItemFactory.getPlayerSkull(player1, "&f" + player1.getName())); inv.setItem( pl.getTradeConfig().getTheirAcceptSlot(), ItemFactory.getPlayerSkull(player2, "&f" + player2.getName())); to if (pl.getTradeConfig().isHeadEnabled()){ inv.setItem( pl.getTradeConfig().getAcceptSlot(), ItemFactory.getPlayerSkull(player1, "&f" + player1.getName())); inv.setItem( pl.getTradeConfig().getTheirAcceptSlot(), ItemFactory.getPlayerSkull(player2, "&f" + player2.getName())); } can solve it if I disable head in config.

Nezz202 commented 3 years ago

Hey. Did this fix work for you? This is a real issue on my server. I'm on 3.79.5 and still getting issue frequently with the server hanging for up to 30 seconds. I'm hesitant to change this as I'm not very knowledable with code ect, and don't want to cause more issues than it fixes. Thanks đź‘Ť

afoxxvi commented 3 years ago

@Nezz202 The code I given above works and solved my problem, and it's proved that the huge lag was caused by loading head textures.

@Trophonix Please fix this problem, it can be completed easily with a little work on method com.trophonix.tradeplus.util.InvUtils.getSpectatorInventory(). Thanks!

Spiritho15 commented 12 months ago

any recent updates regarding this issue?

leviem1 commented 11 months ago

@Spiritho15 I wrote a quick and dirty patch for this but it got hung up in review and I never heard from the plugin author afterwards. I ended up closing the PR due to inactivity.

afoxxvi commented 11 months ago

@Spiritho15 @leviem1 Already fixed very long ago.

leviem1 commented 11 months ago

@Spiritho15 @leviem1 Already fixed very long ago.

Oh sweet, didn't know about that. Can you close the issue @afoxxvi?

afoxxvi commented 11 months ago

I didn’t have noticed it, sorry.