MineColonies

MineColonies

53M Downloads

Crashes with a StackOverflowError - TileEntityColonyBuilding calling TileEntityRack in a recursive loop.

codingkoi opened this issue ยท 23 comments

commented

Before reporting please make sure that this issue was not reported yet (Check out similar issue suggestions).

Also update to the latest alpha of both minecolonies and structurize before reporting

Version: minecolonies-1.12.2-0.11.804-RELEASE-universal
I've tried this on the ALPHA version and had the same issue.

Expected behavior

  • Expected behavior is that the server doesn't crash with a StackOverflow error

Actual behaviour

I created a city for a server I'm running by "pasting" level 5 buildings in creative. I was playing on it for about a week with no problems, but this week it started hitting a point where it would throw a StackOverflowError. I'm not sure exactly what's triggering it and the only solution I've had is to rollback to a previous backup, and then it's fine until suddenly again it's not.

If you look at the stack trace, a TileEntityColonyBuilding is calling a method on a TileEntityRack which is turning around and calling the original method on a TileEntityColonyBuilding (not sure if it's the same instance, but I assume it is) and it does that until the stack overflows.

I thought maybe the "pasting" broke something in the Warehouse or some other building, so I had a builder go around and "repair" the buildings, but that didn't seem to help, as this morning a friend logged in and it immediately crashed again.

Steps to reproduce the problem

Since I'm not quite sure what's going on and sometimes I've played on it for hours without problems, I haven't been able to isolate a repo case.

I have a copy of the broken world and I'm thinking of trying to debug it myself locally, but I'd like some guidance on what this code is actually doing, since the methods in question aren't documented and I don't know what they do.

I can't easily strip out the other mods in the pack to try to see if it's some weird interaction given the amount of custom blocks in the area, and given the trace, I think it's probably isolated to the Minecolonies code.

Logs: Latest.log and crashlog at https://gist.github.com/

Here's the server log. The server was idle before nicragland joined, and then it almost immediately crashed. The night before it was running fine, and no one was on between when I logged off and when my friend joined this morning.

commented

I figure y'all are more focused on more recent Minecraft versions, so I'm happy to try to fix this myself. I'm just not sure what this code is supposed to be doing to know what might be going wrong here.

commented

It's probably calling the wrong super method. Instead of calling the one that will go to the rack it calls the one that goes to the one above the rack because it does super.getCapability(handler) and not getCap(handler, null)

commented

There was a fix pushed between release and alpha aiming at fixing this.
No reason to be snappy about this.

commented

If that doesn't fix it in your particular case there is probably even more to this. But yeah I'd also have to resetup the dev environment for 1.12 again to test it.

commented

Sorry for my snappyness . someaddons response seemed snappy to me, "fixed, closed". I probably should have made sure to provide a trace from the most recent version, instead of just saying "yeah I tried that and rolled back". That's my fault. Sorry.

Communication on the internet is hard, and I let my frustration get the better of me.

commented

Something that makes this hard is I don't have an easy reproduction case. Maybe I could try building a world with just Minecolonies loaded, paste out a bunch of level 5 buildings and leave it running until it crashes, but it's not consistent. Like a few days ago it was crashing every hour or so before I'd have to roll it back, and then yesterday it ran all day without a problem until this morning.

commented

Yeah, that's the problem for us too. You can try to compare how things are done in 1.15 and maybe try to adjust it to that and see if it still happens.

commented

So one of the things I'm not clear on is what these calls are supposed to be doing. This is obviously a new codebase for me and I'm not sure what getCapability is trying to do here.

commented

Oh and @Raycoms if you don't have a 1.12 dev environment handy, don't worry about it, I can look into it later myself. Like I said, I'm willing to do the work. This is all volunteer in your spare time so I don't expect you to just jump to it. I just might need some pointers to understand what this code is supposed to be doing in the correct case.

commented

getCapability in this case gets the inventory of a rack. If the rack is not the main rack of the two, it will ask the other rack for the inventory. When you ask a building about its capability it will include all racks that are part of the building

commented

This is really strange. I can see in the commit history where you clearly put in a fix for this. Is it possible I don't have the latest code? I pulled it off Curseforge, is there a better place to look?

This is the version I'm using now, and still seeing the issue: minecolonies-1.12.2-0.11.841-ALPHA-universal.jar

That is the latest one, right?

commented

How easy would it be for you (or someone else who has their dev environment already set up) to get me a patched version I could test? It will probably take me a while to get the dev setup put together on my end.

Not trying to fork off the work. It just sounds like an easy change for someone who already has their dev environment set up.

commented

that is fixed, use the latest

commented

841 alpha is latest 1.12

commented

I'm pretty sure I did. I'll give it another shot.

commented

๐Ÿคฆ Well, I could swear I tried that. It was literally the first thing I thought to do, but I guess somehow I didn't.

I mean, I already had that jar downloaded and everything. Sorry to have wasted your time with the duplicate report, and thanks for the help ๐Ÿ™‡.

commented

Nope, it's not fixed. Please don't try to gaslight me. I opened a bug report in good faith, even offered to help try to fix it. Did you even look at the stacktrace?

I'm fine with people pointing out when I've overlooked something, but I said I tried the latest, and it turns out I had. I had rolled back because I figured if ALPHA doesn't fix it, I should run on RELEASE in case maybe it's more stable in other ways. Maybe switching versions is what broke something, but it still seems odd to me that this can get into a recursive state. That seems like a bug to me.

Here's an updated one (I included the only line I could find that references the Minecolonies version number in the startup logs).
https://gist.github.com/codingkoi/c9230aca222d0c382bea26800d0bf2e7

I'm happy to try to figured this out on my own. I was really just hoping for some pointers. I'll investigate what @Raycoms mentioned later this evening when I can take the time to set up a dev environment locally.

commented

Okay, I'm gonna try to set up a local dev environment after work and see if I can't get to the bottom of it.

commented

Okay, that's really weird. I had a world that crashes almost immediately on load with that ALPHA jar, but I checked out the repo, switched to the archive/1.12 branch, and built that, and loaded it up with that, and it doesn't crash.

So I feel like the answer is yes, it's fixed, but no, it's not in that ALPHA jar.

@someaddons I want to apologize directly for biting your head off. That was uncalled for. I'm sorry.

commented

Gonna do some more testing to confirm, it's possible it somehow got itself past that state on the last load. Gonna do a fresh run to be sure.

commented

I'm just used to old version reports for stuff that has been fixed xD so closing those fast

commented

Yeah, I imagine that happens a lot on a project like this. I'd love to switch to the newer version, but my modpack has several mods that haven't moved, so I'm kinda waiting to see if they update, or not.

I'm pretty sure it's working now using the code at the tip of the archive/1.12 branch, so I'm gonna toss that jar on my server and see if to happens again. ๐Ÿคž

commented

This is the latest yes.