Fabric API

Fabric API

106M Downloads

Freeze when using mods that have fabric api included in the same jar

lordrius opened this issue ยท 16 comments

commented

Hi people, very strange problem i test and can confirm,

First of all, sorry for my english, i'm spanish...

Using Fabric 1.14 or 1.14.1-pre. When you have installed any mod that have included fabric api, when you're ingame and taps inventory button or left-click/righ-click a block, entity or the air with item or not, game freezes a bit. Also when shift-click item stack in container screen. This behavior only happens ONE TIME until you restarts the game.

Now, if you have a clean instance without any mod or a mod that uses fabric API and the API (two individual files) this behavior never happens...

I've tested with my mod and shedaniel's light overlay that have Fabric API included in the same jar.

Using F3 debug overlay with pie chart, throws an error in console when happens:
[main/WARN]: Something's taking too long! 'root.tick.GLFW events' took aprox 2251.332017 ms
[main/WARN]: Something's taking too long! 'root.tick' took aprox 2254.69372 ms
[main/WARN]: Something's taking too long! 'root' took aprox 2263.784051 ms

I hope you can reproduce it. The solution i found is don't include API in the jar and copy it separately. I have read other issues and i wonder if the #120 issue have the same problem...

Many thanks!!

commented

Sounds absolutely plausible, but I would still be a little surprised.

commented

Mods should NOT jar-in-jar the entire fabric API. Fabric API is a common installation, so bundling it is wasteful. However, there is still an issue.

A previous report indicated that this happens when the nested jar is lazily loaded into memory. This would mean it is not related to #120 and the issue actually belongs in fabric-loader.

commented

Someone did point out possible slow classloading with nested jars, and I think this could be the reason as I used a very similar jar in jar method to fabric in a personal project and also had very slow classloading

commented

Some people are reporting this happening without mods. Not sure if they are just using loader or vanilla.

Could well be a vanilla thing

commented

I tested multiple instances of vanilla and fabric loader, it did not occur for me in vanilla stable or snapshots.
Nor did it occur with just fabric loader installed. I obviously can't say how with mods, since they almost all require Fabric API.
It only starts occurring when I install Fabric API, without any other mods.
My inner-armchair developer thinks it has something to do with the introduction of modularity in 3.0, since that's when I started having these spikes, but I have no idea at all the real culprit.

Reproduceable lag spike for myself:

  1. Creating a new instance in MultiMC with the most recent fabric loader
  2. Playing a superflat world for a few minutes with only the loader, punching things/opening inventory
  3. Closing and installing FabricAPI to the mods folder
  4. Reloading the same instance & super flat world and punching mobs/opening inventory.

Lag spike should be noticeable after a few actions of punching and opening inventory.
Might need to adjust video settings since it's a new instance.

commented

Can confirm I do not get any delays at all in Vanilla 1.14

MC 1.14 with fabric and 60+ mods
fabric loader 1.14+build.21-0.4.7+build.146
fabric-api-0.3.0-pre+build.156

I get a 5-10 seconds delay for each action done for the first time:

  • click the "Singleplayer" button in the MC menu
  • harvest a crop
  • type / in the chat bar
  • attack a mob
  • try to break a block
  • left click a Stockpile mod barrel
  • left click a block with hand

Edit: Nothing at all shows up the the MultiMC console.

Mods:

  always-drop-loot-3.3.1+mc1.14
  AnimalNet-1.7+Fabric+1.14
  antiqueatlas-5.0.0-fabric
  AnvilFix-1.1.2
  appleskin-mc1.14-fabric-1.0.5
  Autofish-0.8.2-fabric-mc1.14
  Couplings-1.0.0
  crowmap-fabric-1.0.1
  DarkElevators-1.14-1.1.3
  deathmaps-1.0.2
  Disenchanting-0.7.2
  DontStubYourToe-1.14.1-1.0.0
  durabilityviewer-1.14-fabric0.2.7-1.5
  fabric-api-0.3.0-pre+build.156
  fabric-language-kotlin-1.3.30+build.2
  FabricMagnet-1.14-1.0.1
  foamfix-0.12.1
  Harvest-1.14-fabric-1.0.4
  Hwyla-fabric-1.14-1.9.16-60
  infinityfix-1.0.4
  informedload-1.1.0
  lead-villagers-1.0.0+mc1.14
  leaf-decay-1.0.2
  mappy-0.0.11a
  miners-horizon-1.3.1
  ModMenu-1.5.4-85
  MoEnchantments-1.4.0
  nbttooltip-1.14-1.0.3
  railboost-0.2.0
  redstone-bits-1.0.3
  RoughlyEnoughItems-2.9.110
  sekcphysics-0.2.0
  Silky-Spawners-1.0.2
  SimpleFireworks-1.0.1.15-universal
  smokeextender-1.2.1
  smoothbedrock-1.1.3
  stockpile-1.0.3+1.14
  TrampleStopper-1.0.0.24-universal
  trapexpansion-1.0.1-fabric
  trident_fixer-1.0.0
  vanilladeathchest-1.14-1.9.2.1-fabric
  vanilla-hammers-1.2.0
commented

Tested with MC 1.14.1 and the issue is still there as described in my previous comment. This is game breaking, since the first encounter with a mob ends in certain death almost always, as the game freeze seems to affect the player but it seems the mob hits kind of add up and get cached or something like that, so one instant you are at 100% health fully armored, you attack the mob, then after the game freezes for 5-10 seconds, you are dead.

MC 1.14.1
fabric loader 1.14.1+build.10-0.4.7+build.147
fabric-api-0.3.0-pre+build.157a

mods:

  always-drop-loot-3.4.0+mc1.14.1
  AnimalNet-1.7+Fabric+1.14
  antiqueatlas-5.0.1-fabric
  AnvilFix-1.1.2
  appleskin-mc1.14-fabric-1.0.5
  Autofish-0.8.2-fabric-mc1.14
  ClothConfig-0.2.1.14
  ClothEvents-0.3.1.23
  Couplings-1.0.0
  crowmap-fabric-1.0.1
  DarkElevators-1.14-1.1.3
  deathmaps-1.0.2
  Disenchanting-0.8.1+mc1.14.1
  durabilityviewer-1.14-fabric0.2.7-1.5
  fabric-api-0.3.0-pre+build.157a
  fabric-language-kotlin-1.3.30+build.2
  FabricMagnet-1.14-1.0.1
  foamfix-0.12.1
  Harvest-1.14-fabric-1.0.4
  Hwyla-fabric-1.14-1.9.16-60
  illuminations-0.1.6-1.14.1
  infinityfix-1.0.4
  informedload-1.1.0
  lead-villagers-1.0.0+mc1.14
  leaf-decay-1.0.2
  mappy-0.0.12a
  miners-horizon-1.3.1
  ModMenu-1.5.4-85
  MoEnchantments-1.5.1
  nbttooltip-1.14-1.0.3
  NightConfig4Fabric-3.6.0
  railboost-0.2.0
  redstone-bits-1.0.4+mc1.14.1
  RoughlyEnoughItems-2.9.112
  sekcphysics-0.2.0
  Silky-Spawners-1.0.2
  smokeextender-1.2.1
  smoothbedrock-1.1.3
  stockpile-1.0.4+1.14.1
  TrampleStopper-1.0.0.27-universal
  trident_fixer-1.0.0
  vanilladeathchest-1.14-1.9.2.1-fabric
  vanilla-hammers-1.3.0
commented

I got this basic profile, I had to fly around for a bit to cause it to happen.

commented

commented

Yeah... Seems URL.hashCode() isnt very fast at all, as it includes the current IP address of the host.

commented

Please try Loader 0.4.7+build.150

commented

0.4.7+build.152, you saw nothing

commented

Seems fixed for me on the latest loader.

commented

This has been solved for me using 0.4.7 build 153. All lag on first use is gone. Thank you.

commented

Fixed. Now I can finally rest. (Also, #191 )