
[SAD] AM2 Being AM2 ([BUG] Server Thread STOP)
Closed this issue · 18 comments
So, I was testing the AM2 Playground on my server, when it started to die, and since I have stall-report installed on my server, it generated some logs to debug the error.
New bug update
I don't quite get it.
So, I was testing the AM2 Playground on my server, when it started to die, and since I have stall-report installed on my server, it generated some logs to debug the error.
Stop like what - slows down to about 0 TPS or crashes?
What Vortex? There is at least Blood Vortex
, Mana Vortex
, Spatial Vortex
and etc.
Tell me more about the situation, cuz AM2 just made this way, highly unoptimized.
Like, if you create [Wave] <Lunar>x299 [Touch] (Rift)
spell and launch it (its kinda cheap in all means) - your server will fucking die eventually, and there is nothing that can be done about it.
About
stalled for at least 30000 ms.
"Server thread" #18 prio=5
RUNNABLE
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:61)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:183)
at airburn.am2playground.preloader.PGEventFactories.onManaRegen_SkillData(PGEventFactories.java:67)
at am2.playerextensions.ExtendedProperties.manaBurnoutTick(ExtendedProperties.java:1600)
at am2.AMEventHandler.onEntityLiving(AMEventHandler.java:534)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_1106_AMEventHandler_onEntityLiving_LivingUpdateEvent.invoke(.dynamic)
No wonder it stalled - I'm calling an EVENT in another EVENT, and it just takes about K*N*M
operations to proceed, where K - entities count, N - amount of registried LivingUpdateEvent
events that should trigger AM2ManaRegenPlayerEvent.SkillData
event, and M - amount of AM2ManaRegenPlayerEvent.SkillData
events (but there is only one).
TBH, if there is a lots of entities AND a lots of mods that register their own LivingUpdateEvent
events - that should be the main issue here, except:
stalled for at least 480000 ms.
"Server thread" #18 prio=5
RUNNABLE
at java.util.HashMap.getNode(HashMap.java:582)
at java.util.HashMap.get(HashMap.java:558)
at net.minecraft.entity.Entity.getExtendedProperties(Entity.java:2766)
at am2.playerextensions.SkillData.For(SkillData.java:63)
at airburn.am2playground.utils.helpers.PGLearnHelper.isSkillKnown(PGLearnHelper.java:78)
at airburn.am2playground.event.forge.PGCommonEventHandler.manaRegenArch(PGCommonEventHandler.java:682)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_802_PGCommonEventHandler_manaRegenArch_SkillData.invoke(.dynamic)
according to your reports, PGLearnHelper.isSkillKnown
method is heavily unoptimized, with bottleneck of... standard Minecraft methods??? Looks like someone is having too much NBT data (probably other mods fault). Nah, nothing can be done about it, sadly. Minecraft is just that.
Okay, main purpose of AM2ManaRegenPlayerEvent.SkillData
is to trigger that code:
public void manaRegenArch(AM2ManaRegenPlayerEvent.SkillData e) {
if(isSkillKnown(e.player, PGSpells.manaRegenArch)) {
e.regenTicks *= 0.45F;
e.setCanceled(true);
}
}
As you can see, it isn't doing much, so for sake of testing I can just throw it away and call it a day.
https://github.com/AirBurn0/am2playground/releases/tag/v0.12.0-debug2
Well, apparently, Ars Magica is unique, players with giant playerdata weighing 90mb, and this is particularly an aberration, because I myself tried to investigate in NBTEditor, and this caused a crash in the application. What I can say is that we should keep polishing, Am2Playground can fix many things and that is fantastic! So, let's go!
I did some diagnostics, and I saw that the server's TPS, as you mentioned earlier, was dropping, and the cause is DrParadox's ars magica
Look
and here:
The spark profile link is here: https://spark.lucko.me/ngtbQZzTHE
But that's it, over time we will fix new bugs that ars magica 2 has been experiencing. "but whoever doesn’t try - doesn’t succeed." XD, Thank you very much!
Well, apparently, Ars Magica is unique, players with giant playerdata weighing 90mb,
lol wtf???? Did you SURE that it's AM2.5 alone that stores 90Mb of data? I think it's total data from all mods, not only AM2.5.
BUT IF IT'S AM2.5 ONLY, THEN... uh... We doomed :D
I did some diagnostics, and I saw that the server's TPS, as you mentioned earlier, was dropping, and the cause is DrParadox's ars magica
It's good that you found some bottlenecks in AM2 but in general entire damn mod is a huge bottleneck due to bad writing. For example, @brandyyn said that entire Spatial Vortex
code is bullshit performance and saved some TPS by removing it.
What I can say is that we should keep polishing, Am2Playground can fix many things and that is fantastic! So, let's go!
But that's it, over time we will fix new bugs that ars magica 2 has been experiencing. "but whoever doesn’t try - doesn’t succeed." XD, Thank you very much!
But I don't understand what I have to do with it - I'm not AM2 maintainer, and don't want to be, for sure (I can't fix her :c).
@RubilaxXxx is, but... Well... It's simply impossible to handle all this code crap in AM2 alone. It's extremely hard and long work to do (and dude won't get paid probably lol so why bother).
Look
and here:
The spark profile link is here: https://spark.lucko.me/ngtbQZzTHE
Well, I'm not really get what you trying to tell me. AM2 performance always was a crap, and also that maybe explains that one situation in my life when I randomly crashed someone's server via flying near Ice Guradian...
But I'm not fighting for AM2 performance here, it's about to be impossible from my side.
It's better to talk about it with @brandyyn if dude still working on his project.
Note that am2pg may NOT support @RubilaxXxx or @brandyyn forks due to critical codebase changes
according to #29 probably DrParadox7 AM2.5-LTS-1.6.10-LE
UCH arsmagica2{1.6.7} [Ars Magica 2] (AM2.5-LTS-1.6.10-LE.jar)
any reason why you made your own "isskillkown" when there's "isentryknown" in AM2 ?
any reason why you made your own "isskillkown" when there's "isentryknown" in AM2 ?
overloading
I mean,
SkillData.For((EntityPlayer)caster).isEntryKnown(SkillTreeManager.instance.getSkillTreeEntry(SkillManager.instance.getSkill("AugmentedCasting")))
is cursed API.
In other hand,
PGLearnHelper.isSkillKnown((EntityPlayer)caster, "AugmentedCasting")
is good (I also optimized some calls so it wont call skillTreeManager)
Dude, AM2 API is bullshit sometimes.
i shall summon the big guy @DrParadox7 maybe he has some better info
Well, apparently, Ars Magica is unique, players with giant playerdata weighing 90mb,
lol wtf???? Did you SURE that it's AM2.5 alone that stores 90Mb of data? I think it's total data from all mods, not only AM2.5. BUT IF IT'S AM2.5 ONLY, THEN... uh... We doomed :D
I did some diagnostics, and I saw that the server's TPS, as you mentioned earlier, was dropping, and the cause is DrParadox's ars magica
It's good that you found some bottlenecks in AM2 but in general entire damn mod is a huge bottleneck due to bad writing. For example, @brandyyn said that entire
Spatial Vortex
code is bullshit performance and saved some TPS by removing it.What I can say is that we should keep polishing, Am2Playground can fix many things and that is fantastic! So, let's go!
But that's it, over time we will fix new bugs that ars magica 2 has been experiencing. "but whoever doesn’t try - doesn’t succeed." XD, Thank you very much!But I don't understand what I have to do with it - I'm not AM2 maintainer, and don't want to be, for sure (I can't fix her :c). @RubilaxXxx is, but... Well... It's simply impossible to handle all this code crap in AM2 alone. It's extremely hard and long work to do (and dude won't get paid probably lol so why bother).
Look
and here:
The spark profile link is here: https://spark.lucko.me/ngtbQZzTHEWell, I'm not really get what you trying to tell me. AM2 performance always was a crap, and also that maybe explains that one situation in my life when I randomly crashed someone's server via flying near Ice Guradian... But I'm not fighting for AM2 performance here, it's about to be impossible from my side. It's better to talk about it with @brandyyn if dude still working on his project. Note that am2pg may NOT support @RubilaxXxx or @brandyyn forks due to critical codebase changes
Yes! Players who were focused and deep into Ars Magica, had their player data huge with 60 ~ 90mb, I tried to diagnose the cause of this, but the NBT Editor simply stopped working! But this can be avoided, it is not something urgent, what would be fatal is this Massive TPS drop!
@RubilaxXxx I've looked at spark and nothing really jumps out to me outside of the AM2 boss AI being too nested, but even then that's just 5% of the load so not the culprit.
That's a difficult one to fix. I can't really help outside of a LE environment where I know this are somewhat more stable.
Might be worth ripping off LE configs on AM2.5 and see if that has improvements.
It's simply impossible to handle all this code crap in AM2 alone.
I won't be fixing AM2.5 as the handling of player data, rendering issues, mana storage and even just the config handling are just the tip of the iceberg on what would need to be redone.
There were some disagreements between me and Matrix on how AM2.5 should be handled and anything too laggy has configs that can be used to disable it (just so we can leave to users to choose between performance an features).
brandyyn said that entire Spatial Vortex code is bullshit performance and saved some TPS by removing it.
That’s a perfect example. I had already patched it sensibly with configs. If the spells relying on it were disabled, the laggy Spatial Vortex code would too be disable as well.
DrParadox7/ArsMagica2@a956f59
Simply removing the method will cause NPEs, so DYOR before making changes and using other's forks.
I'll be rewriting AM2.5 at my own pace, and the new version will be entirely incompatible with existing addons (except Magic Bees, which I'll also be rewriting).
While the spellwriting system itself is solid, it lacks proper UX and meaningful progression so that too will be addressed.
If you're looking for solutions, you can try amputating even more methods, but expect unintended side effects... It might not function as intended and could introduce even more issues.
Well, let's go, the mod has an old problem, I haven't tested it and see if the version (AM2.5-LTS-1.6.10-LE) has fixed it, but what are the main lag points that could be fixed?
-
The mod makes multiple calls to get the list of worlds and entities, however, when you get the list of worlds, Forge makes a read-only copy, constantly calling this causes a lot of unnecessary memory copies!
-
The mod uses string representation of uuids as a key, however, it has several repetitive calls, perhaps it can be converted to just one?
Well, I need to diagnose more and more, I'm going to make more sparkles, timings and samplers... I'll come with the diagnostics soon, but see if what I said earlier has any basis or not...
The mod makes multiple calls to get the list of worlds and entities, however, when you get the list of worlds, Forge makes a read-only copy, constantly calling this causes a lot of unnecessary memory copies!
I remember already fixing this for the LE. You should consider my prior advice:
That's a difficult one to fix. I can't really help outside of a LE environment where I know this are somewhat more stable.
Might be worth ripping off LE configs on AM2.5 and see if that has improvements.
@Akashiic are you sure that this should be discussed in my repository?
My addon works quite ok, it's just AM2 being bullshit it always has been, mostly thanks to Mithion.
I'll be rewriting AM2.5 at my own pace, and the new version will be entirely incompatible with existing addons (except Magic Bees, which I'll also be rewriting).
BTW, that sucks, but... Well, I can see why. It's impossible to properly maintain backward compatibility with API like that and such amount of bugs, so go on, really.
I'm generally okay about everything except being asked to fix entire AM2. I kind of know what and how can be fixed here and there, but heh, it will take more time that I ever willing to spent on that.