CyclopsMC / IntegratedTunnels

Transfer other energy, items and fluids over Integrated Dynamics networks
MIT License
20 stars 13 forks source link

Leaving area of energy importer unselects variable card #157

Closed MrSpencerRecor closed 5 years ago

MrSpencerRecor commented 5 years ago

Issue type:


Short description: If i have a variable card in the "import energy slot" either blank or always set to true, it'll unselect if I go far away and no longer send energy from the energy battery.

1.set up a battery with importer and logic cable on the battery and power going to the battery.

  1. tp far out/over 140 blocks away
  2. come back to the spot of battery, notice the importer is red and not working/drawing out power. The varible card is no longer selected. 2019-02-20_09 48 26

2019-02-20_09 48 48

2019-02-20_09 48 53

...#### Expected behaviour: I figured that setting the variable card to true would fix the problem, but instead it didn't fix anything. Even a blank card didn't work.

Versions:

Log file:

https://pastebin.com/45CCeRLc

rubensworks commented 5 years ago

I haven't seen this problem in a long time. This means that the part somehow got corrupted. I don't see anything indicating in your logs, so I don't have any clue at the moment what would be causing this.

Can you reproduce this problem consistently? If so, can I send you a dev build that outputs additional debug logs in a couple of days to help me debug the issue?

MrSpencerRecor commented 5 years ago

I haven't seen this problem in a long time. This means that the part somehow got corrupted. I don't see anything indicating in your logs, so I don't have any clue at the moment what would be causing this.

Can you reproduce this problem consistently? If so, can I send you a dev build that outputs additional debug logs in a couple of days to help me debug the issue?

Oddly enough; i've tried multiple times, and cant replicate it in any world. One of the weirdest bugs i've ever experienced. So i'm not sure if it's even fixable on your end. I can break all the blocks and replace and it still happens. I can spawn in the blocks needed and it still happens. But only in this world. It's strange.

rubensworks commented 5 years ago

Perhaps I should rephrase my question more clearly:

In your current test world, can you make the bug appear consistently when unloading/reloading the chunk? If so, can I send you a dev build that outputs additional debug logs in a couple of days to help me debug the issue?

rubensworks commented 5 years ago

@MrSpencerRecor Bump. Would love to fix this issue.

tommyTT commented 5 years ago

Hey there, I would be interested to help tracking down this problem. Yesterday I encountered a similar behavior in my Enigmatica 2 Expert world when some of my networks got "corrupted". This happened a few times before, but I could never determine what actually caused it. Yesterday for the first time I actually saw the "Network corrupted" message, before that I can only remember seeing the red borders on the tunnels. Removing the variable card and re-inserting it sometimes fixed it, other times I had to remove all the components. Most of the networks were really small: simple transfer of energy, items and fluids over a few blocks inside a chunk. Is there anything I can do that would help "after the fact"? I might still have a backup from yesterday when I encountered the corrupted network state. Or is it necessary to catch the corruption "in the act"? In that case I couldn't find any errors in the standard debug log, but I could use a debug version of the mod that might output additional information.

rubensworks commented 5 years ago

@tommyTT Thanks for being willing to help! :-) I'll send you a debug version soon.

rubensworks commented 5 years ago

Ok, the seems to be that somehow parts become corrupted. In fact, I already built in a workaround for this, which is why you may be seeing things like this in your logs:

A corrupted part state was found at, repairing...

However, it looks like the repair job fails sometimes.

In order to figure out where these things are occurring, I've added a stack dump each time such a repair job is being performed.

@tommyTT @MrSpencerRecor Could you try out the latest dev build of Integrated Dynamics (See maven link in README) and share the full Forge logs with me once a corruption occurs? Thanks in advance!

It is possible that you'll have to update to the latest dev builds of CyclopsCore, CommonCaps and IT as well

tommyTT commented 5 years ago

I'm able to reproduce this now with only the Integrated Dynamics and Tunnels mods as well as their dependencies installed. I updated my testing instance with the newest builds from the repo and I see the mentioned statements in the debug log:

https://paste.ee/p/xQ9Vs

The way I reproduce it:

  1. Start a new world and go outside the spawn chunks.
  2. I have used a setup like in the following picture.
  3. Now go away, so the chunk can unload (about 150 blocks should do it).
  4. Return (if you remember where your setup was :)) and the tunnels show the red outline. Here is a video that shows this process.
Paste.ee
View Paste xQ9Vs
Paste.ee - View Paste xQ9Vs
rubensworks commented 5 years ago

@tommyTT It looks like you were too quick to download the dev build, it was still being built appartently, my bad. Can you try again with build 1301? That one includes the stack traces.

tommyTT commented 5 years ago

No problem, same result with that build and here is the new log:

https://paste.ee/p/syi0t

Paste.ee
View Paste syi0t
Paste.ee - View Paste syi0t
rubensworks commented 5 years ago

Thanks! I can see the stacktraces now.

rubensworks commented 5 years ago

The stacktraces were less useful than I hoped. I've prepared a new build that prints some more information. @tommyTT Could you share your log again with the following build? https://www.dropbox.com/s/9bvs64igk8a9d86/IntegratedDynamics-1.12.2-1.0.7-DEV.jar?dl=0

Dropbox
IntegratedDynamics-1.12.2-1.0.7-DEV.jar
Shared with Dropbox
tommyTT commented 5 years ago

Here is the new log:

https://paste.ee/p/sPpbx

Paste.ee
View Paste sPpbx
Paste.ee - View Paste sPpbx
rubensworks commented 5 years ago

@tommyTT Here is a new build that may fix the issue: https://www.dropbox.com/s/8mt2bk4eawt7k7s/IntegratedDynamics-1.12.2-1.0.7-DEV-.jar?dl=0

In case it does not fix the issue, I've included some more debug output to figure out the next step. In case the problem isn't solved for you, can you share your logs again?

(I'm off for today btw)

Dropbox
IntegratedDynamics-1.12.2-1.0.7-DEV-.jar
Shared with Dropbox
tommyTT commented 5 years ago

Seems good so far. I will test a bit more and report back. Thanks for your efforts.

tommyTT commented 5 years ago

After more testing there is still an issue. The tunnels don't show the error state any more but they still stop working. Taking the variable card out and putting it back in helped "restarting" the network before, that no longer works. Instead I have to remove a part of the network and replace it - in my case a cable.

This is my testing setup now (again, way outside the spawn chunks): https://imgur.com/a/Bm9sg1w The left chest is filled with blocks, the right one is empty. The exporter has a blank variable card for "Export all", the stack size is reduced to 1 and the tick rate of the tunnel increased to 20 ticks.

Here is the correpsonding log. However I don't see any debug info from the mod.

Imgur
Minecraft Screenshots
Post with 1 views. Minecraft Screenshots
rubensworks commented 5 years ago

@tommyTT Is that testing setup in an environment with only ID+IT? If so, could you share that world with me?

tommyTT commented 5 years ago

Yes, here is a world that is prepared for you: https://cp.sync.com/dl/706ba3490#ijfqnmgy-4kunnmnq-g5ndppmd-zk49zmp3

On spawn you should see a command block that teleports you a 1000 blocks away where the setup is located. The command block you find there teleports you another 1000 blocks away, where you find one more command block that teleports you back again. Steps to reproduce it:

Yesterday I tried a bit of debugging in a dev environment and it looks to me, that on chunk reload, the inventory of that tile does get restored, but the network is never rebuilt (org.cyclops.integrateddynamics.core.part.PartStateActiveVariableBase#onVariableContentsUpdated is never called). But not knowing the rest of the code and some weirdness with IntelliJ and Lombok didn't allow me to get further. Best of luck!

Sync
Sync | Secure cloud storage that protects your privacy
rubensworks commented 5 years ago

Great, thanks a lot @tommyTT! That should definitely allow me to properly resolve the issue. I won't be able to look into this before next week though.

tommyTT commented 5 years ago

A quick look at the recent changes, I found this commit that would explain the behaviour. Before the change, the variables were read from inventory, which is correctly deserialized. Now it only reads the variable cache but that is never re-initialized after reloading the chunk. Maybe this information is helpful.

rubensworks commented 5 years ago

Indeed, that's definitely related to the problem. In the dev build I have to you I added a variableContainer.refreshVariables call before the variable cache loop in case it was empty. Unfortunately, it does not seem to resolve the problem completely, so there is something else (possibly related) going wrong somewhere.

rubensworks commented 5 years ago

@tommyTT For reference, I just pushed a commit that includes the (partial) fix that you have in your dev build. If you're feeling adventurous, feel free to experiment further with the code related to that. I'll try to get back to this next week.

rubensworks commented 5 years ago

The fix wasn't too complex after all. Thanks a lot for your help @tommyTT! This helped a lot :-)

Feel free to try out the latest ID dev build.

tommyTT commented 5 years ago

No problem, I'm happy to help out. I tried the latest dev build and couldn't find any problems. Thank you for your work!