Missing helper AIs should clear group rather than crash
Moderator: Moderators
Missing helper AIs should clear group rather than crash
Suppose you and your teammate are playing a game, and your teammate uses weird_helper.dll and assigns it to a unit.
Then, he crashes or disconnects. You, then, do a .take of his units. This in turn leads to you taking a unit with weird_helper.dll, which you don't have.
The game will then crash and spit out this missing AI, leading to your next teammate taking your units and suffering the same fate.
There's no need for this. It should be fairly simple to catch this exception and just clear the group for the missing AI, perhaps spitting out a warning in the process.
Then, he crashes or disconnects. You, then, do a .take of his units. This in turn leads to you taking a unit with weird_helper.dll, which you don't have.
The game will then crash and spit out this missing AI, leading to your next teammate taking your units and suffering the same fate.
There's no need for this. It should be fairly simple to catch this exception and just clear the group for the missing AI, perhaps spitting out a warning in the process.
True. But we should still fix the problem, especially because of the terrible exploit I just thought of:AF wrote:+1 This is a must.
However there is an AI side fix. Exception handling. I use it as a failsafe for my AIs so that if they crash the AI can catch the error and display a message and proceed to shut itself down so the player can carry on playing.
- Create stupid_ai.dll that no one has.
- Assign stupid_ai.dll to a peewee and give to opponent.
- Opponent crashes.
Erm, no.AF wrote:+1 This is a must.
However there is an AI side fix. Exception handling. I use it as a failsafe for my AIs so that if they crash the AI can catch the error and display a message and proceed to shut itself down so the player can carry on playing.
The bug is that Spring crashes if the Group AI DLL is not available on the other PC, so there is no way you can fix this AI side, definitely not with exception handling.
-
- Posts: 272
- Joined: 30 May 2006, 17:06
This is an excellent example of a very small bug that gets out of hand. The cascade failure is really one of those "oh fuck" moments for the programmer.
Hehe, thankfully i think you can't give units to enemies without .cheat since the latest version.YokoZar wrote:Actually, for irony purposes, you should probably use a crasher instead of a peewee.
- Create stupid_ai.dll that no one has.
- Assign stupid_ai.dll to a peewee and give to opponent.
- Opponent crashes.
Tobi, theyre not the same bug.
Yokozars talking about an exploit, crash caused by spring
What Im talking about is when the AI itself is at fault and spring unnecessarily exits.
This would cause a crash in the groupAI. This would then be caught by spring. Spring would then exit unnecessarily. Instead it should remove the AI from the game and continue.
I said try catch because:
Thus the error is caught by the AI and the AI deactivates itself.
Yokozars talking about an exploit, crash caused by spring
What Im talking about is when the AI itself is at fault and spring unnecessarily exits.
Code: Select all
CGroupAI::Update(){
int* a = new in[5];
a[20]=4;
}
I said try catch because:
Code: Select all
CGroupAI::Update(){
if(active==false) return;
try{
int* a = new in[5];
a[20]=4;
}catch(...){
cb->SendTxtMgs("This AI has crashed",0);
active=false;
}
}
I know what you are talking about but it is totally unrelated to this bug, which was my point.
Also as I already explained a long time ago, try catch blocks do not catch segfaults or other signals (unless SEH is enabled but that's MSVC specific), they only catch exceptions.
Also as I already explained a long time ago, try catch blocks do not catch segfaults or other signals (unless SEH is enabled but that's MSVC specific), they only catch exceptions.
Code: Select all
$ cat test.cpp
#include <iostream>
using std::cout;
using std::endl;
int main()
{
try{
int* a = NULL;
*a=10;
cout << "no exceptions caught" << endl;
}catch(...){
cout << "caught exception" << endl;
}
return 0;
}
$ g++ test.cpp -o test
$ ./test
Segmentation fault (core dumped)
.take should take his helper AIs though, if the taking player has them. There's no reason to clear the metal maker AI after .take, and users would likely think it a bug if it were.imbaczek wrote:Hopefully it's fixed, I disabled transferring groups between players. See mantis #596.
As for units given away, sure, clearing the AI is fine.