NebulaModTeam / nebula

A multiplayer mod for the game Dyson Sphere Program
GNU General Public License v3.0
835 stars 124 forks source link

why this error Thread Error Exception Thread idx:1 Inserter Factory idx:1 Inserter second gametick total cursor: 5483 Start & End: 0/264 #602

Closed ZeluEee closed 1 year ago

ZeluEee commented 1 year ago
An error has occurred! Game version 0.9.27.15466 (Client)
Mods used: [IlLine1.0.0] [LDBTool2.0.6] [DSP Mod Save1.1.4] [DSP Common API1.5.6.0] [NebulaMultiplayerMod0.8.12.3] [NebulaMultiplayerModApi1.3.1.3] [BulletTime1.2.10] [Common API Nebula Compatibility1.5.6.0] 
Thread Error Exception!!! Thread idx:1 Inserter Factory idx:1 Inserter second gametick total cursor: 5483  Start & End: 0/264  System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at CargoPath.TryPickItem (System.Int32 index, System.Int32 length, System.Int32 filter, System.Int32[] needs, System.Byte& stack, System.Byte& inc) [0x000b7] ;IL_00B7 
  at CargoTraffic.TryPickItem (System.Int32 beltId, System.Int32 offset, System.Int32 filter, System.Int32[] needs, System.Byte& stack, System.Byte& inc) [0x00028] ;IL_0028 
  at PlanetFactory.PickFrom (System.Int32 entityId, System.Int32 offset, System.Int32 filter, System.Int32[] needs, System.Byte& stack, System.Byte& inc) [0x00035] ;IL_0035 
  at InserterComponent.InternalUpdate (PlanetFactory factory, System.Int32[][] needsPool, AnimData[] animPool, System.Single power) [0x00244] ;IL_0244 
  at FactorySystem.GameTickInserters (System.Int64 time, System.Boolean isActive, System.Int32 _start, System.Int32 _end) [0x0013a] ;IL_013A 
  at WorkerThreadExecutor.InserterPartExecute () [0x001e3] ;IL_01E3 
starfi5h commented 1 year ago

Seem like a sorter or belt is corrupted. If this only happens on client, try to update the mod version to 0.8.13 and reconnect.

ZeluEee commented 1 year ago

i just rebulid everythings with error planet ,Error disappears

ZeluEee commented 1 year ago

I guess the player and server archives are not synchronized

starfi5h commented 1 year ago

This may cause by flip belt function doesn't sync in nebula mod version 0.8.12. If you encounter the error in 0.8.13 version again, feel free to leave the steps to reproduce it.

ZeluEee commented 1 year ago

![Uploading f9db2d17ebf041a3172ee1dae05de9b.png…]() I didn't do anything,just working in another galaxy,sorter or belt is corrupted,i try to rebuild sorter and belt,is nouseless

ZeluEee commented 1 year ago

f9db2d17ebf041a3172ee1dae05de9b

starfi5h commented 1 year ago

Then it had something to do with action of host player. Can you provide the save file, or log file BepInEx\LogOutput.log ?

ZeluEee commented 1 year ago

LogOutput.log beplnex version is 5417 may be i must update,i try update to 5421

starfi5h commented 1 year ago

The BepInEx version warning is harmless. Since Nebula doens't use new features of BepInEx, BepInEx version 5.4.17 and all higher version can work.

[Warning:NebulaMultiplayerMod] Server report an error: 
IndexOutOfRangeException: Index was outside the bounds of the array.
CargoPath.TryPickItemAtRear (System.Int32[] needs, System.Int32& needIdx, System.Byte& stack, System.Byte& inc) (at <c63ca23bdae94e4485ecdf93f54e107d>:IL_0084)
StationComponent.UpdateInputSlots (CargoTraffic traffic, SignData[] signPool, System.Boolean active) (at <c63ca23bdae94e4485ecdf93f54e107d>:IL_00B1)
PlanetTransport.GameTick_InputFromBelt (System.Int64 time) (at <c63ca23bdae94e4485ecdf93f54e107d>:IL_0061)
GameData.GameTick (System.Int64 time) (at <c63ca23bdae94e4485ecdf93f54e107d>:IL_0360)
GameMain.FixedUpdate () (at <c63ca23bdae94e4485ecdf93f54e107d>:IL_01A2)

Looks like there are already corrupted belts/stations on the dedicated server though.

ZeluEee commented 1 year ago

have some resolvent? Some error plent space station cant input item

ZeluEee commented 1 year ago

https://www.123pan.com/s/4ENUVv-MVAlA.html here is save

starfi5h commented 1 year ago

Sorry I still don't know what cause the error. But I've managed to locate the corrupted buildings: 1 station, 2 sorters and many cargo on belts. I've removed them so there is no more error on the host save. Not test on client yet. https://drive.google.com/file/d/1kAgbX40DsXUXN9lfbwrVFogBeLZoIUmx/view?usp=share_link The error may still reappear though.

ZeluEee commented 1 year ago

Can you tell me how to find the wrong building and rebuild it i thing i can solve it bymyself

starfi5h commented 1 year ago

Using HarmonyFinalizer to catch exception and print the id

[HarmonyFinalizer, HarmonyPatch(typeof(StationComponent), nameof(StationComponent.UpdateInputSlots))]
static Exception UpdateInputSlots(StationComponent __instance, Exception __exception)
{
    if (__exception != null)
    {
        var planet = GameMain.galaxy.PlanetById(__instance.planetId);
        Log.Warn($"Staion: {__instance.id} entityId={__instance.entityId} on {planet?.displayName}, {planet.id}");
    }
    return null;
}

[HarmonyFinalizer, HarmonyPatch(typeof(InserterComponent), nameof(InserterComponent.InternalUpdateNoAnim))]
static Exception InternalUpdateNoAnim(InserterComponent __instance, PlanetFactory factory, Exception __exception)
{
    if (__exception != null)
    {
        var planet = GameMain.galaxy.PlanetById(factory.planetId);
        Log.Warn($"Inserter: {__instance.id} entityId={__instance.entityId} on {planet?.displayName}, {planet.id}");
    }
    return null;
}

After planetId and entityId are known, call GameMain.galaxy.PlanetById(planetId).factory.RemoveEntityWithComponents(entityId); to remove the buildings.

ZeluEee commented 1 year ago

i create a new save,when i use large blueprint,error start in a few minutes. i think proble is blueprint (maybe is bulidings shifting blueprint ) LogOutput.log