Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 910 forks source link

Auto starting the Bot after a Crash #389

Open kshahnazari opened 11 years ago

kshahnazari commented 11 years ago

After A little working with the bot there is a big problem with it , Sometime the bot crashes (That you can see it by Red text) . The thing is sometimes the crash isn't really important and when You leave the bot And it crashes you really get upset about it the thing I want to say is there must be an option in settings or somewhere or a way to code it that if the bot crashes (Red text again!) The bot could automatically restart itself

FrozenHaxor commented 11 years ago

Most recent crashes are caused by extremely slow Steam servers, pity the Summer sale. Bots can't even download the item schema...

Jessecar96 commented 11 years ago

This really should be added. Maybe even an auto restart option in the settings file. There's a bunch of ways a bot can crash, and it'll just sit offline if it does.

waylaidwanderer commented 11 years ago

It's happening too fast for me to catch, but some exceptions thrown crash the entire SteamBot process. Good thing I have a script that restarts it if it happens.

thesandvichisaliar commented 11 years ago

Restarting a bot in general is pretty easy. All you have to do is reinitialize a bit. Getting it to restart in the case of all crashes would require more work.

I haven't used this in a while, but it worked before. https://github.com/thesandvichisaliar/SteamBot/commit/53d33e68cbd026a44ab9ae20ae111a95facc71e4

The restriction is that you would then have to call the restart from wherever you got your error (e.g. BackgroundWorkerOnRunWorkerCompleted, your userhandler, BotManager, etc.) Since you mention the red text in your log, I assume your error(s) are either in BackgroundWorkerOnRunWorkerCompleted or OnTradeError.

kshahnazari commented 11 years ago

So what's the schedule are we going to change it for everyone or we should write the codes or put(write) a script in our programs ?

SteamPunk89 commented 10 years ago

@FrozenHaxor Thank you, somebody else with a brain notes that the Servers are to blame for the copious amounts of timeouts and errors currently. @Jessecar96 Seconded. I have an autostart script on my Linux VPS but as for including one in SteamBot itself, that is a good idea. It will help those without hosting access.

BlueRaja commented 10 years ago

@SteamPunk89 SteamBot has had auto-restart for a long time now. If it's not working, that's a bug. Are you able to attach a debugger and pause the execution, to determine exactly where it's stuck?

VaporFan commented 10 years ago

@BlueRaja : Sometimes it looks like online but not working. I have experiences with this, I modified the Bot Manager to ensure that no one could add the bot as friend and the bot will be "disabled" if it disconnects from steam network. But this code seems not always be run , sometimes the bot still online but not response to requests. I don't know how to handle with this, maybe we need an interval to check for bot online status as come in handy ?

Sometimes, there was an exception thrown internally, a warn message comes out said Restarting... but actually it's not gonna restarting.

But I have a faith that this is my own problem :( I want to force bots to reconnect, what should I do? please give me some advice