Hi,
I've found some troubles with oxp's that did use setAI recently. It's easy to make a subtle mistake and not be aware of it, thus I'd like some security change in oolite to prevent problems:
1) When a request is made to switch/set AI from AI A to AI A then simply change that AI state and probably also add a warning message to the log.
2) When circular AI requests are made (like AI A to AI B to AI A) then fall back to the requested AI which was suspended and exit the others. Also change that targets AI state and probably also add a warning message to the log.
I guess both cases can even be handled by one check if the check keeps both cases in mind. Furthermore, for case 2 it would be very difficult to prevent this from inside an oxp.
That would prevent unnecessarily growing AI stacks and AI overflow problems. Maybe that way the current AI limit could even be drastically reduced (if that helps in some way).
Screet
Security change for AIs
Moderators: winston, another_commander
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
I’m not clear on what problem you want to solve.
Last edited by JensAyton on Sat Oct 24, 2009 1:48 pm, edited 1 time in total.
E-mail: [email protected]
The AI overflow problem. Some missiles do change the AI - and previously this did cause trouble when too many missiles did hit the same target. I've fixed that oxp by checking if that AI is already active - then nothing happens. However, this is no good fix: Multiple hits by different missiles cannot be detected this way. Other scripts also do change the AI, adding up to the AI stack.Ahruman wrote:I’m not clear on what problem you want to solve.[/list]
Furthermore, if an AI itself does call another AI and that again calls another AI, it's also not possible to stay safe in a proper way, as it's difficult from outside oolite to determine wether the AI to change to is already somewhere further down in the stack.
That's why I asked to add a safety check to that functionality within the Oolite code: if the requested AI is already on the stack somewhere, simply go back to that one.
Screet
Or just set a maximum size to the AI stack, and report an error if it's exceeded? Or simply teach people better the difference between setAI and switchAI?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Oolite already does this.Thargoid wrote:Or just set a maximum size to the AI stack, and report an error if it's exceeded?
E-mail: [email protected]
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
But it is logged, so the scripter knows there is probably something wrong and he can correct it. I think the maximum stack size is about 32. Sounds high enough for me as a normal script would never put that many AIs on stack.Screet wrote:But that won't help to avoid the situation. IIRC L once got that error and had a massively spammed log.Ahruman wrote:Oolite already does this.Thargoid wrote:Or just set a maximum size to the AI stack, and report an error if it's exceeded?
Screet
UPS-Courier & DeepSpacePirates & others at the box and some older versions
To reiterate, the spammed log is due to some logic fault within the OXP code.
Once that OXP code is fixed, you'd get no more spamming & no more potential overflow.
As if by magic!
Once that OXP code is fixed, you'd get no more spamming & no more potential overflow.
As if by magic!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)