Chunk gets unloaded when dialing from computer interface
drzpk opened this issue · 21 comments
When I'm trying to dial a distant Stargate (on unloaded chunk) using OpenComputers interface, the dialing sequence gets interrupted before a wormhole is established. However, dialing exactly the same address via a DHD ends successfully.
I did some debugging (using the most recent version built from sources) and it turns out that chunk unload event is fired on the chunk I'm dialing to and that interrupts the dialing sequence. I compared code of dialing from DHD and computer interface and there is indeed a difference, I don't know the internals of this mod to pursue this further, though.
For the record, creating a Forge chunk loader ticker doesn't load the chunks immediately. As such, in your forceChunkRangeOnTicket method, you might want to do a World:getBlockState() in each chunks to force the loading so the rest of mod doesn't have to deal with that mess.
Also, it appears the ticket is released and recreated when the gate state is changing. When releasing a ticket, forge may unload the chunks immediately under certain conditions & configurations, causing a whole of issues (memory leak, lag spike and state desynchronization). I suggest to keep existing ticket with its chunks instead of releasing and creating a new ticket.
I think Zidane added an appropriate fix for this. I am including in the 2.0.5 build to be released tonight, give that a try please.
Well, I have this same problem, but when I created respond I got was "You probably have mod, that changes chunk loading", that was true, so I give up, but today I checked it with only Stargate Network, malisiscore and OC, and it still happening.
@ilynPayne A tak w ogóle to fajny twój program wybierający.
In your configuration files, under "options:", what do you have I:chunkLoadingRange= set to?
Please try this: http://solder.almuramc.com/downloads/SGCraft-2.0.4-beta-3.jar
It's set to 1, I've never modified it. But you assumed otherwise, hence the beta-3 artifact. Well, I tested it anyway and - surprise, surprise - it didn't work. dialing still gets interrupted.
Please take a look at this issue, especially the code snippets. Mine, called from the Lua shell, doesn't work, while @dallenwilson's does.
No, this message you've just added didn't show up.
I uploaded the thread dump you asked for (with breakpoint at SGCraft:579, b1937ccf). I also managed to reproduce this error using the world save uploaded below (SGCraft started from Intellij and dependency mods only, no other mods were used). There's an OC setup somewhere around X=33, Y=72, Z=309, just repeat the last command.
Curious. Zidane was thinking the mod to blame would be in the trace, yet SF is in the trace....
The Lua shell currently is running in the dialing computer and the last command I entered was sg.dial
, so just like in a "real" shell, pressing arrow up and then enter will execute it.
I'm making some assumptions as I have no way to test this exactly with your environment. I have not been able to replicate this in my environment but I am not using CC. Looking at how the chunk ticket is created is "SHOULD" keep the gate active.
I need you to give me a thread dump at line 578 of SGCraft.java.
I could create a debug build specifically for you. Talking with another developer we're curious if you're hitting the max chunk ticket threshold. That would cause this issue as well.
Pull down this commit: b1937cc and compile. Tell me if you're seeing that debug line during dialing.
Actually no, that can't be the issue either because you specifically stated using the DHD works fine....
WTH...
Please try this: http://solder.almuramc.com/downloads/SGCraft-2.0.4-beta-5.jar
Thanks goes to you for creating a way for me to perfectly test this. I had researched this previously but could never reproduce it. You're the reason this is fixed for everyone else.