BuckarooBanzay / epic

epic -- Enhanced Programmer for Ingame Control
Other
6 stars 2 forks source link

Infinite loops easy to make #40

Closed oversword closed 2 years ago

oversword commented 2 years ago

If you place the blocks with the green sides facing each other you can easily enter an infinite loop accidentally, cuasing the server to crash.

With my setup I placed a start block and an unstash block next to each other, on executing the start block the game enters an infinite loop and crashes.

The mod should either

  1. disallow this kind of placement, possibly with an error message
  2. detect this kind of loop at runtime and refuse to execute it
BuckarooBanzay commented 2 years ago

disallow this kind of placement, possibly with an error message

Some loops are actually allowed and make sense (as long as there is an exit condition)

detect this kind of loop at runtime and refuse to execute it

I'm leaning more towards that solution, maybe with a simple cpu-usage tracker that does some kind of overheat/cancel actions like the mesecons mod does :thinking:

oversword commented 2 years ago

Yeah that could do it, ATM it's just hitting the recursion limit & crashing, maybe you could just have a counter that stops it before it hits the limit and changes their state to "overheated" or something

BuckarooBanzay commented 2 years ago

That was surprisingly easy: i just added a counter to the recursed function:

2021-10-29 08:09:10: [Server]: [epic][executor] max recursion depth exceeded at: (-137,9,1)