AppliedEnergistics / Applied-Energistics-2

A Minecraft Mod about Matter, Energy and using them to conquer the world..
https://appliedenergistics.github.io/
Other
1.43k stars 653 forks source link

Server Crash related to fuzzy crafting (inconsistent range) #3768

Closed PhanaticD closed 5 years ago

PhanaticD commented 6 years ago

Describe the bug

Server crashes on chunk load of affected setup To Reproduce

not sure exactly Expected behavior

no crash Additional context

here is the crash report: https://pastebin.com/raw/7s9EgZpu

here is the affected region file: https://www.dropbox.com/s/sny87w07k2c7wly/r.-1.-5%20-%20Copy.zip?dl=0

I was able to fix it by deleting both the crafting cpus and output buses with fuzzy cards in them from the players base in nbtexplorer

Environment

All the Mods 3 - Remix modpack version 0.1.2

yueh commented 6 years ago

I cannot do anything with the region file itself. Also to actually debug these particular crashes, it needs to be reduced to basically AE2 plus one or two mods. Otherwise it is simply impossible.

As this is the second occurrence lately and no others before, I would assume some mod did start doing funny things lately with meta or damage values. (This code is pretty much unchanged since 1.7.10).

PhanaticD commented 6 years ago

the player whos base it was said they were crafting a garden scythe from cyclic, using a export bus with a crafting card (which was going into a mechanical user from extra utilities)

RustyXXL commented 6 years ago

https://pastebin.com/raw/SfehSmgZ

I got pretty much the same issue in my slightly modified ssp enigmatica 2 expert skyblock instance. Funny thing is the instance pretty much ran for about 12 hours with the same autocrafting exports without crashing. I just started autocrafting a plant gatherer from industrial foregoing a few moments prior to the crash. The recipe for that is heavily modified. I then tested further in a test world with the same mod pack, and could reproduce the issue pretty quickly. I added the minimum required crafting recipes and as soon as I tried to craft the plant gatherer the game crashed again. Most of the components were used in other recipes, and crafted without issues there. The only 2 unique ones I added, apart from the plant gatherer were the iron axe and the iron hoe. Both of them are modified by a mod, so that they are pretty much useless for anything else than crafting, so I suspect that those are the issue in my case. I'm currently trying to figure out, what mod alters them. Once I figure out more, I will report back.

Edit: It is definitely the Industrial Foregoing Plant gatherer that was the issue for me. I'm either not smart enough or to tired, or possibly both to figure out if the problem is related to the modified axe and hoe or the plant gatherer itself, but removing the crafting task via nbtexplorer fixed my world so far.

yueh commented 6 years ago

Most likely the modified tools as they are damagable and therefore subject to fuzzy filtering. And it sounds like they break some stuff to enforce a very special behaviour.

mindforger commented 6 years ago

i looked into the scripts and configs of the pack, it doesn't look like they changed the recipe for it but i can't see in the original recipe what item except for the machine case (which shouldn't have damage value) could cause this, can you tell the (most exact) recipe you programmed to nail down the item in question?

RustyXXL commented 6 years ago

I will post screenshots of all related recipes in the pattern terminal in a bit. I tried to craft the plant gatherer manually and in doing so I tried to put the iron hoe in the system out of habit. It didn't go in, and when closing and reopening the crafting terminal it didn't show any more items. Restarting the game did seem to fix it, but now I can't craft anymore with the system. I noticed it while trying to craft crafting cards, which I have done multiple times before. I can choose it, but when trying to click next on the select amount screen, nothing happens. Something is horribly borked now in my system :/

Edit: http://prntscr.com/l5br58 This is the recipe I used for the Plant Gatherer. Items with a green box are the ones that I used before in other crafting recipes and have worked without crashing. I added the recipes for the axe and the hoe. The axes go into the system without problems. The hoes I can't even put in the system, as described above. The other issue I have seems unrelated. For some reason I can't seem to use crafting tables in any recipes as soon as I add a recipe for them. If I craft them by hand and remove the recipe everything seems to work fine, which still is strange, as I have crafted a bunch of crafting cards before, and the crafting table was one of my first recipes and nothing has changed there, but I can work around that for now.

NielsPilgaard commented 5 years ago

The issue still occurs if all scripts modifying the ingredients are removed.

RustyXXL commented 5 years ago

Yeah, sorry, I forgot to update this. We narrowed it down to the iron hoe. I tried removing all craft tweaker scripts and cyclic. Both didn't help. I also removed the Thaumcraft aspects, the 5x5 grass breaking feature from Quark, and a line from the rustic config, that mentioned the iron hoe, all without success. There is another report now for the ender io farming station on @NillerMedDild Enigmatica 2 Expert 2 Skyblocks Github, that uses the supremium hoe in its recipes, so it would seem it is related to the hoes in that pack, but I'm out of ideas as to which mod is causing it.

Edit: while Checking what's different between the 2 Hoe's that cause problems, and other tools, that work fine I stumbled over something. I don't knowif it is the real problem, but at least it's something. I noticed, that the hoes are oredicted as toolHoe, while the other tools are not. I then looked for hoes that are not oredicted. The Avaritia Hoe, and the twilight forst ironwood hoe are not oredicted and go into the system just fine, while 2 or 3 other hoes that also are oredicted won't work. I still don't know what's the source for it, though. maybe @NillerMedDild has some more insight in which mod adds the oredict entry for the hoes.

Edit 2: I confirmed the at least in my case the toolHoe oredict is the problem, by removing the iron hoe from the oredict. https://github.com/NillerMedDild/Enigmatica2ExpertSkyblock/issues/187#issuecomment-430028844

NielsPilgaard commented 5 years ago

I can confirm that the issue is the toolHoe oredict that is on the hoes used. Some mod generates it and applies it to all hoes, after CraftTweaker runs.

RustyXXL commented 5 years ago

After further looking into it, I noticed that the problem doesn't occur in StoneBlock, even though the Hoe's also have the toolHoe Oredict. So it seems the oredict isn't the main cause. I am currently trying to crossreference all the mods, that the "All the mods 3 - remix" modpack and Enigmatica 2 Expert Skyblock have in common, that are not present in StoneBlock.

These are all the mods that I have found: Akashic Tome Apple Skin Astral Sorcery Better Advancements Bibliocraft Blockcraftery Blood Magic Diet Hopper elulib Fast Workbench Fencejumper Gendustry Immersive Petroleum Inventory Tweaks Just Enough Resources NotEnoughIDs Open Computers Quark Quick Leaf Decay Rustic Thaumcraft Thaumic Inventory Scanning Thaumic JEI

I already tried removing Quark and Rustic from the pack, but it didn't have an effect (Except crafttweaker complaining) Any help in narrowing that list down would be greatly appreciated. I am aware, that there are a bunch of mods in that list that are unlikely to be the cause, but I wanted to be as complete as possible, in case I overlooked something, and checking each of these mods individually is rather timeconsuming.

Edit: Updated the list to reflect crossreferencing with the FTB Revelation Pack and some of my Testing.

mindforger commented 5 years ago

you can accelerate the search by doing a binary search

backup your mods folder and now remove around half the mods without breaking the pack too badly (move not delete)

if the issue persists, do it again if the issue is gone, switch the current mods with the moved (plus the ones bein neccesary at all times)

repeat this until you are left over with few enough mods to nail the culprit down

EDIT: be aware, it is possible that this is an interaction of more than two mods! you may remove one part and it starts working but it is maybe not the only cause

lombax5832 commented 5 years ago

https://pastebin.com/raw/SfehSmgZ

I got pretty much the same issue in my slightly modified ssp enigmatica 2 expert skyblock instance. Funny thing is the instance pretty much ran for about 12 hours with the same autocrafting exports without crashing. I just started autocrafting a plant gatherer from industrial foregoing a few moments prior to the crash. The recipe for that is heavily modified. I then tested further in a test world with the same mod pack, and could reproduce the issue pretty quickly. I added the minimum required crafting recipes and as soon as I tried to craft the plant gatherer the game crashed again. Most of the components were used in other recipes, and crafted without issues there. The only 2 unique ones I added, apart from the plant gatherer were the iron axe and the iron hoe. Both of them are modified by a mod, so that they are pretty much useless for anything else than crafting, so I suspect that those are the issue in my case. I'm currently trying to figure out, what mod alters them. Once I figure out more, I will report back.

Edit: It is definitely the Industrial Foregoing Plant gatherer that was the issue for me. I'm either not smart enough or to tired, or possibly both to figure out if the problem is related to the modified axe and hoe or the plant gatherer itself, but removing the crafting task via nbtexplorer fixed my world so far.

How did you go about the fix via nbtexplorer? I'm having trouble finding the crafting task.

lombax5832 commented 5 years ago

@RustyXXL How did you go about the nbtexplorer fix? I'm having the exact same issue myself and would like to know. Did you just delete the entire crafting cpu entry from the tileentity tab in the region file?

yueh commented 5 years ago

Closing as it is pretty much confirmed that some other mods breaks tools in a way that these are no longer valid itemstacks.

RustyXXL commented 5 years ago

@lombax5832 Update the pack or look on the Enigmatica 2 Expert Skyblock github for the issue where I posted a workaround, so that you shouldn't need to nbtedit your save. I deleted the crafting cpu that was crafting the farmer and the controller just to be save. That allowed me to reload the save. Just to be completly save I completly tore down my ae system, saved, restarted and rebuild it. (I planned to do that anyway, because it was a mess) but it was a major pita.

PhanaticD commented 5 years ago

@yueh maybe we could have it print a warning and fail nicely then instead of completely crashing the server?

mindforger commented 5 years ago

How should this fail nicely in your opinion? Abort the job and spamming into the log with every crafting attempt? Spamming the chat? I ask seriously, because this would mean a spam of issues because autocrafting would abort for unknown reason...

To be more precise think of autocrafting

PhanaticD commented 5 years ago

tbh anything is better, spam time limits might be too much to ask, but as long as the coordinates and the error are in console

even just having the coordinates prior to a crash would have helped a lot

GStefanowich commented 5 years ago

Kind of laughed to myself when @RustyXXL said they ruled it down to the iron hoe. Was just trying to use my AE crafting interface to craft a recipe that involved an iron hoe. Tossed one of the hoes into the system, and it locked up. Couldn't take items in or out. Decided to try throwing it into the system by tossing it into an AE Interface. Getting a similar crash now.

Playing on the revelation pack, my only fuzzy card is in a storage bus attached to a trash can. Fuzzy card in general doesn't like the item for some reason. Going to try to do some of my own investigating.

RustyXXL commented 5 years ago

Updated the list of potential mods, to reflect the Revelation info and some of my own testing. Still not found the mod responsible, but couldn't do to much testing for rl reasons.

Edit: I'm at a loss here. The toolHoe oredict is definitely from EnderIO. Narrowing the list down to only the mods that are common in all 3 problematic packs but are not in Stoneblock, that doesn't have the crash + EnderIO shows no indication of the problem. So it would seem the cause is not in one of those mods, but rather somewhere else, which makes it somewhat more difficult to find...

dkowis commented 5 years ago

Just for others, we're experiencing the same crash when trying to autocraft a Plant Gatherer from Industrial Foregoing.

Our list of mods that intersects with these mods is as follows:

Akashic Tome
Apple Skin
Astral Sorcery
elulib
Just Enough Resources
Open Computers
Quark
Quick Leaf Decay
Rustic
Thaumcraft
Thaumic Inventory Scanning
Thaumic JEI
Mitchimol commented 5 years ago

Hey guys. I am having the same issue with the FTB Revelations mod pack, but I don't think it is necessarily related to the autocrafting. In my set up I had a fuzzy card that moved gold/iron tools that were picked up by my RF tools quarry to either a smelter or a trash can.

When I sent them to trash can, the server crashed immediately. When I sent them to a chest that feeds a redstone furnace the server did not crash immediately. It seems that the server did not crash because going to the chest until the chest filled up. It seems like the fuzzy card is somehow crashing when it tries to send items to something that is full. crash-2018-10-14_20.57.25-server.txt

You can reproduce this by using a fuzzy card to send iron/gold tools to a trash or furnace.

Martmists-GH commented 5 years ago

So how can we fix this issue permanently without having to remove the affected block every time?

Derkades commented 5 years ago

I got this when crafting the Plant Gatherer from Industrial Foregoing, using a recipe I had just added to a molecular assembler + interface setup. I was able to craft a Plant Sower (also from IF) just fine. The main difference between the two machines is that the plant gatherer uses tools in its recipe (2 iron axes and an iron hoe). This is even more evidence that it is related to item metadata/durability, as suggested above.

Nividica commented 5 years ago

I also have encountered this issue. Added the recipe for the plant gatherer, clicked start, instantly brought down the server, and have not been able to keep it running. The server will come up for the breifest moment and then it hits the java.lang.IllegalArgumentException: inconsistent range again. I have a ton of recipes added to my system, several use tools and weapons, however this was the first time that I needed either the iron axe or iron hoe. I do not have any cable parts which are using the fuzzy card.

Pack: FTB Revelation Action: Start crafting job for Industrial Foregoing: Plant Gatherer Relevant recipes: All three recipes, Iron Axe, Iron Hoe, and Plant Gatherer have 'Allow Substitutions' enabled.

If I make any discoveries as to the root reason of the issue, I will report back.

Nividica commented 5 years ago

I have been able to reproduce the issue with the following setup: Mods: AE2@rv5.11, EnderCore@0.5.39, EnderIO@5.0.33, Mantle@1.3.2.24, and TConstruct@2.10.1.87 Setup:

Steps: Place energy cell, attach cable to cell, attach export bus to cable, place chest next to export bus Put fuzzy card in export bus Set hoe as export bus filter Wait 1-2 seconds Crash

Of note: AE2 added hoes do not cause crash, no other tools cause crash. Removing either TConstruct or EnderIO prevents the crash. Mantel and EnderCore were never removed, it seems solely an interaction between TCon and EIO. While testing patterns in the Molecular Assembler, I encountered the following output in the log

[21:19:47] [Server thread/WARN]: Using CraftingManager fallback: Recipe <minecraft:iron_hoe> for output <1xitem.hoeIron@0> rejected inputs [32xitem.stick@0, 1xitem.ingotIron@0, 1xitem.stick@0, 1xitem.stick@0]. NOT FOUND, please report.
[21:19:47] [Server thread/WARN]: Using CraftingManager fallback: Recipe <minecraft:iron_hoe> for output <1xitem.hoeIron@0> rejected inputs [1xitem.ingotIron@0, 32xitem.stick@0, 1xitem.stick@0, 1xitem.stick@0]. NOT FOUND, please report.
[21:19:48] [Server thread/WARN]: Using CraftingManager fallback: Recipe <minecraft:iron_hoe> for output <1xitem.hoeIron@0> rejected inputs [1xitem.ingotIron@0, 1xitem.ingotIron@0, 32xitem.ingotIron@0, 1xitem.stick@0]. NOT FOUND, please report.
[21:19:48] [Server thread/WARN]: Using CraftingManager fallback: Recipe <minecraft:iron_hoe> for output <1xitem.hoeIron@0> rejected inputs [1xitem.ingotIron@0, 1xitem.ingotIron@0, 1xitem.stick@0, 32xitem.ingotIron@0]. NOT FOUND, please report.
Nividica commented 5 years ago

I have found a work-around for the time being, if you have CraftTweaker installed. Bear in mind that this is taking a hammer to the problem, and it happens to work. I suspect with more time invested, a more pin-point solution could be found by adjusting the recipes for hoes. What I think is happening: AE2 starts a fuzzy search for hoes, it encounters the recipes added by TConstruct, because the hoes were added to the ore dictionary by EnderIO. Something about those recipes and/or iterating through them causes the inconsistent range exception.

I was able to get everything smoothly working again by removing all hoes from the ore dictionary. Unfortunately EnderIO does not have an option to disable oredict+hoe integration, and is hard-coded here I did this by adding a CraftTweaker script called 03_oredict_hoes.zs(00-02 already exist in FTB) to the scripts folder with the following:

#Name: oredict_hoes.zs
#Author: Nividica

print("Initializing 'oredict_hoes.zs'...");

for item in <ore:toolHoe>.items {
    <ore:toolHoe>.remove(item);
}

print("Initialized 'oredict_hoes.zs'");

You could easily just add the for loop to an existing script and it should work the same.

Edit: Tested single player, and uploaded to our server. The server was mid-craft on the plant gatherer when it crashed, and was able to continue on once the hoes were out of the oredict.

NielsPilgaard commented 5 years ago

Did you do anything special other than the CraftTweaker script to remove the oredict? I was unable to remove it, a few months ago.

Nividica commented 5 years ago

Nope, that was it. I just removed all items from the category of toolHoe and things started running smoothly again.

NielsPilgaard commented 5 years ago

Cool, I'll try again then, thanks.

tterrag1098 commented 5 years ago

How exactly is this an EIO issue?

Rseding91 commented 5 years ago

I'm getting this same issue with AE when trying to import a Mattock from Tinkers Construct while using fuzzy storage busses to filter incoming items on Enigmatica 2 Expert 1.44. The tooltip in-game is saying it has an ore dictionary entry of toolHoe but it shouldn't. Some mod is adding it to the ore dictionary.

Why that causes a crash here I don't know but it seems like it shouldn't.

I can provide the entire save file (which crashes every time it's loaded) if it helps diagnose the issue. The above "remove all items from oredict::toolHoe" script doesn't work to remove the mattock from the ore dictionary for me.

mindforger commented 5 years ago

@tterrag1098

It kind of sounds something goes bogus with the oredict on tools between tcon and EIO that primarely causes AE to misbehave, and i might throw in, i may seen something similar with immersive enginerring and the assembler. Unfortunately i only got my phone with me while visiting my family, so i can not look for the links to the issues that easily.

yueh commented 5 years ago

@tterrag1098 Nothing (most likely), people just tend to cling to bogus, yet easy solutions, which don't work at all.

@Rseding91 There is a small chance that a save might help. But the actual reason is most likely that some mod fucks up at runtime. Most likely some invalid metadata/damage value, screwing with caps, other itemstacks, or similar. Nothing oredict related at all. So it needs to be debugged as whole modpack, which is pretty much impossible to get it running in dev. Currently I can only thing of one option to try. But that is already pretty borderline as each try probably takes 20-30 minutes and I would have to anticipate the outcome in advance, otherwise it would be completely wasted effort.

Rseding91 commented 5 years ago

@yueh the save: https://www.dropbox.com/s/kfi4dm7ol3ujdrg/3464d44a8e740ff2d0b03c02de3f1236.7z?dl=0

The problem mattock is in an ender chest below my mob spawner at block position 309, 83, 1810.

Pack: Enigmatica 2 Expert version 1.44 Minecraft version: 1.12.2 Forge version: 14.23.5.2768

Launching through the Twitch launcher.

yueh commented 5 years ago

I cannot say if it applies to the other reports, too. But here the issue is that the mattock is broken from tinkers construct. So everything shares the same id and in case of broken, it has no damage value/metadata/etc, so it drops down until it hits our nbt compare. Which is a bit dodgy as it is highly optimized for speed as well as the vanilla/forge methods not even being sufficient for our needs.

No idea how we could currently prevent it without having a major break in behaviour. E.g. it would consider any tinkers construct tool as similar item. Say filtering for wooden swords will include every tinkers sword regardless of used materials. So have fun with it trashing your high end gear, because there is something set up to trash all wooden swords.

Rseding91 commented 5 years ago

Having the filter not work (match too much) is better than crash-locking a save file. Or, just rejecting any filter that attempts to set from a tinkers tool.

yueh commented 5 years ago

A crash can usually be fixed, destroyed data never. So it simply is not an option. Also it is not just tinkers construct. There are a couple of other broken mods like mekanism, which use a single item with the same metadata for at least a part of there items and just store the actual itemtype as NBT somehow.

I have a couple of ideas to evaluate. Yet they are not that easy to really test in terms of performance indev aus long as there is no way to mock these itemstack somehow. And there are a couple of strange assumptions by vanilla/forge, which might actually be a bit too restrictive with our current approach. E.g. any item outside the range of [-2^15,2^16] (Yes ^16 not 2^15-1 as expected with a short) are considered empty.

1.13/1.14 will certainly make it easier, but it pretty much is guaranteed to consider everything with the same id as the same item. That is simply the way minecraft handles it and as long as mods do not flatten their ids, it will be that way. Also Oredict/tags probably have to go. They will get way too ambiguous, like iron could have tags like ingotIron, anyIngot, mobDrop, or iWantToTagEveryItemForRandomReasons. Even we might have a anyIngot tag for crafting cable anchors. So a fuzzy export bus set to export iron, will also export gold or any other existing (metal?) ingot.

yueh commented 5 years ago

There is a PR which should fix it while maintaining the current behaviour. The CI currently builds it as rv5, in case some other mods depend on rv6, you probably have to build your own jar in case you want to test it before a new release is done.

With 1.13 it is pretty much guaranteed to make it less complicated as I plan the change the internal data structures. But that means it will consider everything with the same item id as the same item in fuzzy mode. At least as long as forge provides a simple way to compare NBT based types without having a special case for every mod out there (or any successor should the not manage to release it for 1.13+)

Flextt commented 5 years ago

Nividicas workaround worked for me in ATM3 Remix 1.0.1. I too had attempted to craft a Plant Gatherer and inserted patterns for an Iron Hoe and Plant Gatherer into my MAs with an immediate crash to desktop upon issueing the request.