Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfRange #15

Closed
Vectorial1024 opened this issue Apr 24, 2022 · 16 comments
Closed

ArrayIndexOutOfRange #15

Vectorial1024 opened this issue Apr 24, 2022 · 16 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Vectorial1024
Copy link
Owner

AFAIK, reported both from Steam and Discord.

Should be sth like, when loading into map, or when simulating, it throws ArrayIndexOutOfRange, and the stack trace immediately mentions ExpressBusServices.

@Vectorial1024 Vectorial1024 added bug Something isn't working question Further information is requested labels Apr 24, 2022
@Vectorial1024
Copy link
Owner Author

Vectorial1024 commented May 14, 2022

Cant seem to reproduce it.

As some added info, the error report looks something like this:

ArrayIndexOutOfRange
Stacktrace:
TransportLine.GetNextStop
EBS Do-for-each-passenger
...

The error occurs inside some internal game code, At hispoinnt it becomes a bit confusing as to why it even happened in the first place. I totally do not see this occuring on my side...

Edt: seeing that the code referennesthhe NetManager, I am thinking that the road network is somehow broken so that it causes problems. Maybe mods like 81 tiles can cause problems like that?

@Kovoschiz
Copy link

Kovoschiz commented Jul 2, 2022

Hi, I encountered this error, but the cause seems different. The message comes from Invert IPT2 determine unbunching etc (modules?). It showed up soon after I switch to aggressive unbunching. Switching back to legacy/prudential avoids the problem. I'm using 81 Tiles, however I'm only playing with my city in 25 tiles so far except external roads and other infrastructure (I have drawn an approximate border around it).
I didn't have the logs saved, so I need to try once more if you want my case.

@Vectorial1024
Copy link
Owner Author

I still haven't yet confirmed it myself, but yeah I can see why 81 Tiles is a problem

81 Tiles will have to modify the game's data structure to support potentially using every bit of 81 tiles, and so even though you are using less than 25 tiles, the inner workings of the game are already changed, and the aggresive mode (which asks about where is the next bus stop) will be very likely to be affected.

Legacy/prudential is not affected because it only counts and modifies the waiting time at stops; it does not interact with the inner workings of the game that deep.

It is mainly because normally I dont use 81 Tiles that I cant see this problem during development; besides, testing with 81 Tiles adds in some complexity

@pionsix
Copy link

pionsix commented Jul 18, 2022

Hi,

I've had this issue for a few months now but have only got around to looking at the full error log in the pop-up (Through Extended Error Reporting).

I worked out early on that, for me at least, the error relates to Sunset Harbour intercity buses reaching a node on the highway a few hundred metres before the map edge (I also use 81 tiles). It doesn't seem to always happen but when it does, all Intercity buses get caught and fling backwards and forwards. I have been periodically checking and removing these vehicles with TMPE delete button.

I've attached an example log below to help confirm that this is the same issue. I've started a new city on a new map in the last few days and get the error both on this new map and my previous (Both were custom), but I don't think the map is the issue.

`
An exception occured during VehicleAI simulation step.
Asset: 2073435960.Murrays Coach_Data
VehicleID: 13733
Type: BusAI
Severity: High

System.IndexOutOfRangeException: Array index is out of range.
at TransportLine.GetNextStop (uint16) <0x00045>
at ExpressBusServices.TransportLineUtil.DoWithEachPassengerWaiting (uint16,System.Action1<uint16>) <0x00042> at ExpressBusServices.TransportLineUtil.CountPassengersWaiting (uint16,int+,int+) <0x000ef> at ExpressBusServices.Patch_PublicTransportExtraSkip.ExtraSkippingLogic (VehicleAI,uint16,Vehicle+) <0x001fc> at (wrapper dynamic-method) VehicleAI.VehicleAI.ArrivingToDestination_Patch2 (VehicleAI,uint16,Vehicle+) <0x00059> at (wrapper delegate-invoke) TrafficManager.Patch._VehicleAI.Connection.ArrivingToDestinationDelegate.invoke_void__this___VehicleAI_uint16_Vehicle+ (VehicleAI,uint16,Vehicle+) <0x0009c> at TrafficManager.Patch._VehicleAI.UpdatePathTargetPositionsPatch.Prefix (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x03dc2> at (wrapper dynamic-method) VehicleAI.VehicleAI.UpdatePathTargetPositions_Patch1 (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x001e6> at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x009ba> at BusAI.SimulationStep (uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x0012b> at (wrapper dynamic-method) VehicleAI.VehicleAI.SimulationStep_Patch1 (VehicleAI,uint16,Vehicle+,uint16,Vehicle+,int) <0x00598> at TrafficManager.Patch._VehicleAI._CarAI.SimulationStepPatch.Prefix (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x0069b> at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00057> at HealkitMod.Patches.VehicleManagerPatch.SimulationStep (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00062>

@Kovoschiz
Copy link

Does this mod interact with intercity buses???

@Vectorial1024
Copy link
Owner Author

Ah with the new info, everything becomes a bit clearer.

First thing: my testing environment:

  • I do not have the Sunset Harbour DLC
  • I do not use 81 Tiles

This may explain why I seeming just cannot see any problem with this mod even when a lot of people outside are saying "this mod got problems".

Second: whether this mod made sense:

  • I am starting to think maybe intercity buses need not be included in the fast-depart mechanism; afterall, if it is intercity, staying for 5 minutes at the terminus is only a trivial amount of time, compared to eg 5 minutes for a dense downtown line where the entire trip is under 15 minutes
  • When intercity buses are departing the map, obviously they do not have a "next stop" to check, so it is gonna cause problems when the Aggressive Mode starts checking for the next stop.

I can think about this and make an update later, and then you may check if it works on your side.

@Kovoschiz
Copy link

Kovoschiz commented Jul 19, 2022

Yeah, shortening turnaround time for intercity bus doesn't make it much more realistic. It only takes up stand at a bus terminal, not streetside stop.

@Vectorial1024 Vectorial1024 added the focus A focus for the short term: is WIP or being planned label Jul 20, 2022
@Vectorial1024
Copy link
Owner Author

Hi all, the update was released on Steam alongside the release of #12, so you may recheck if the update fiixed this issue.

@pionsix
Copy link

pionsix commented Jul 27, 2022

Hi, I've loaded up Cities to test. I've definitely got the update as I've observed the "service self-balancing" which works very well. I did, however, get the same error with the intercity buses.

An exception occured during VehicleAI simulation step.
Asset: 2073435960.Murrays Coach Single Door_Data
VehicleID: 30412
Type: BusAI
Severity: High

System.IndexOutOfRangeException: Array index is out of range.
at TransportLine.GetNextStop (uint16) <0x00045>
at ExpressBusServices.TransportLineUtil.DoWithEachPassengerWaiting (uint16,System.Action`1) <0x00042>
at ExpressBusServices.TransportLineUtil.CountPassengersWaiting (uint16,int+,int+) <0x000ea>
at ExpressBusServices.Patch_PublicTransportExtraSkip.ExtraSkippingLogic (VehicleAI,uint16,Vehicle+) <0x001fc>
at (wrapper dynamic-method) VehicleAI.VehicleAI.ArrivingToDestination_Patch2 (VehicleAI,uint16,Vehicle+) <0x00059>
at (wrapper delegate-invoke) TrafficManager.Patch._VehicleAI.Connection.ArrivingToDestinationDelegate.invoke_void__this___VehicleAI_uint16_Vehicle+ (VehicleAI,uint16,Vehicle+) <0x0009c>
at TrafficManager.Patch._VehicleAI.UpdatePathTargetPositionsPatch.Prefix (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x03dc2>
at (wrapper dynamic-method) VehicleAI.VehicleAI.UpdatePathTargetPositions_Patch1 (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x001e6>
at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x009ba>
at BusAI.SimulationStep (uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x0012b>
at (wrapper dynamic-method) VehicleAI.VehicleAI.SimulationStep_Patch1 (VehicleAI,uint16,Vehicle+,uint16,Vehicle+,int) <0x00598>
at TrafficManager.Patch._VehicleAI._CarAI.SimulationStepPatch.Prefix (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x0069b>
at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00057>
at HealkitMod.Patches.VehicleManagerPatch.SimulationStep (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00062>

I looked a bit more closely and the issue occurs at the final node before the map boundary and the bus is in the second lane trying to get across one to the outside lane.

@Kovoschiz

This comment was marked as duplicate.

@Kovoschiz
Copy link

Kovoschiz commented Jul 27, 2022

Ok with Extended Error Reporting's vehicle id and error message suppressing, I can confirm the culprit is the same as others in dev mode with the help of traffic route view.
Aggressive + IPT2 First Principle:

An exception occured during VehicleAI simulation step.
Asset: 2441471395.Ryde-E500-MegaRyde-Intercity_Data
VehicleID: 48244
Type: BusAI
Severity: High

System.IndexOutOfRangeException: Array index is out of range.
at ExpressBusServices_IPT2.IPT2UnbunchingRuleReader.ReadAndInterpretIsConsideredAsTerminus (uint16,uint16) <0x00047>
at ExpressBusServices_IPT2.Patch_DepartureChecker_CheckEligibleForInstaDepart.PostFix (bool+,uint16,uint16) <0x00042>
at (wrapper dynamic-method) ExpressBusServices.DepartureChecker.ExpressBusServices.DepartureChecker.StopIsConsideredAsTerminus_Patch1 (uint16,uint16) <0x000b7>
at ExpressBusServices.DepartureChecker.CanSkipNextStop (uint16,Vehicle+) <0x0002a>
at ExpressBusServices.Patch_PublicTransportExtraSkip.ExtraSkippingLogic (VehicleAI,uint16,Vehicle+) <0x001b0>
at (wrapper dynamic-method) VehicleAI.VehicleAI.ArrivingToDestination_Patch1 (VehicleAI,uint16,Vehicle+) <0x00036>
at (wrapper delegate-invoke) TrafficManager.Patch._VehicleAI.Connection.ArrivingToDestinationDelegate.invoke_void__this___VehicleAI_uint16_Vehicle+ (VehicleAI,uint16,Vehicle+) <0x0009c>
at TrafficManager.Patch._VehicleAI.UpdatePathTargetPositionsPatch.Prefix (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x03daa>
at (wrapper dynamic-method) VehicleAI.VehicleAI.UpdatePathTargetPositions_Patch1 (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x001e6>
at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch0 (CarAI,uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x009a2>
at BusAI.SimulationStep (uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x0012b>
at (wrapper dynamic-method) VehicleAI.VehicleAI.SimulationStep_Patch1 (VehicleAI,uint16,Vehicle+,uint16,Vehicle+,int) <0x00598>
at TrafficManager.Patch._VehicleAI._CarAI.SimulationStepPatch.Prefix (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x006a4>
at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00057>
at HealkitMod.Patches.VehicleManagerPatch.SimulationStep (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00062>

3
10
They are having an orgy, stuck at the last node before exiting the map, going back and forth causing traffic to pile up behind them. All of them in this outside connection are Flags: Created, Spawned, TransferToTarget, DummyTraffic, 0. (so meaning they are simulated external--external non-stopping through traffic, right?) There are a total of 7 intercity buses here.
(Can't pause quick enough to screenshot) Most importantly, intercity bus that need to stop to disembark passengers at the last segment road side here are not affected. ( actual external--internal--external stopping service for the player city? don't remember their mechanisms)

@Vectorial1024
Copy link
Owner Author

I guess this is an improvement? I have the impression that previously it was "every kind of bus does not work all the time", and now it looks like it is "intercity bus does not work near map edge". This is still an unresolved bug though.

This means that I have missed some cases when checking for intercity buses. Hopefully this can be fully fixed in the next update.

@jedi93
Copy link

jedi93 commented Jul 28, 2022

Hi, I also got this error. No IPT2 or TLM, self-balancing is disabled...

429,811ms | Simulation error: Array index is out of range.
at TransportLine.GetNextStop (uint16) <IL 0x00019, 0x000da>
at ExpressBusServices.TransportLineUtil.DoWithEachPassengerWaiting (uint16,System.Action1<uint16>) <IL 0x00002, 0x00181> at ExpressBusServices.TransportLineUtil.CountPassengersWaiting (uint16,int&,int&) <IL 0x0002d, 0x001a9> at ExpressBusServices.Patch_PublicTransportExtraSkip.ExtraSkippingLogic (VehicleAI,uint16,Vehicle&) <IL 0x0007e, 0x0057d> at (wrapper dynamic-method) VehicleAI.VehicleAI.ArrivingToDestination_Patch1 (VehicleAI,uint16,Vehicle&) <IL 0x0001b, 0x000e7> at (wrapper delegate-invoke) TrafficManager.Patch._VehicleAI.Connection.ArrivingToDestinationDelegate.invoke_void__this___VehicleAI_uint16_Vehicle& (VehicleAI,uint16,Vehicle&) <IL 0x00055, 0x00270> at TrafficManager.Patch._VehicleAI.UpdatePathTargetPositionsPatch.Prefix (VehicleAI,uint16,Vehicle&,UnityEngine.Vector3,int&,int,single,single) <IL 0x00ceb, 0x073f5> at (wrapper dynamic-method) VehicleAI.VehicleAI.UpdatePathTargetPositions_Patch1 (VehicleAI,uint16,Vehicle&,UnityEngine.Vector3,int&,int,single,single) <IL 0x0003c, 0x0056d> at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch0 (CarAI,uint16,Vehicle&,Vehicle/Frame&,uint16,Vehicle&,int) <IL 0x001f2, 0x0125a> at BusAI.SimulationStep (uint16,Vehicle&,Vehicle/Frame&,uint16,Vehicle&,int) <IL 0x00092, 0x00274> at (wrapper dynamic-method) VehicleAI.VehicleAI.SimulationStep_Patch1 (VehicleAI,uint16,Vehicle&,uint16,Vehicle&,int) <IL 0x00188, 0x00972> at TrafficManager.Patch._VehicleAI._CarAI.SimulationStepPatch.Prefix (CarAI,uint16,Vehicle&,UnityEngine.Vector3) <IL 0x0021e, 0x00fc0> at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle&,UnityEngine.Vector3) <IL 0x00024, 0x001dc> at VehicleManager.SimulationStepImpl (int) <IL 0x0023a, 0x00b78> at SimulationManagerBase2.SimulationStep (int) <0x0008e>
at VehicleManager.ISimulationManager.SimulationStep (int) <IL 0x00002, 0x00054>
at SimulationManager.SimulationStep () <IL 0x0024e, 0x00d83>
at SimulationManager.SimulationThread () <IL 0x00096, 0x00329>

@Vectorial1024
Copy link
Owner Author

Hi all, I have reimplemented the fix, see if it works now.

@pionsix
Copy link

pionsix commented Jul 31, 2022

I have tried for a few hours today and everything appeared to work. I observed a few intercity buses successfully exit the map. Thank you for your time fixing this.

@Vectorial1024
Copy link
Owner Author

Nice!

Also thanks to the Sunset harbour owners for testing this on my behalf.

I can therefore close this.

@Vectorial1024 Vectorial1024 removed the focus A focus for the short term: is WIP or being planned label Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants