Archisteamfarm: Crash when Sending Keys to Bot

Created on 27 Jun 2016  路  11Comments  路  Source: JustArchiNET/ArchiSteamFarm

26/06/2016 19.36.07 [!] EXCEPTION: UnhandledExceptionHandler()

Object reference not set to an instance of an object.
StackTrace:
at ArchiSteamFarm.Bot.b__64_0(Bot bot)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at ArchiSteamFarm.Bot.d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__82.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__96.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Bug Confirmed Medium priority

All 11 comments

Version? Used command? Bot options?

@JustArchi Local version: 2.1.0.7 | Remote version: 2.1.0.7
1234

And what was the command, and sent to which one of those 3 bots? Command as in !redeem with what parameters.

the result same whether i send to 2 and 3.

Weird, what is the result of !statusall ? It looks like Dictionary contains Bots that are null, which should never be the case, unless ASF logical issue. Can you show me the full log with the crash? It's important.

26/06/2016 19.33.40 [_] INFO: CheckForUpdate()

Checking new version...
26/06/2016 19.33.42 [_] INFO: CheckForUpdate()
Local version: 2.1.0.7 | Remote version: 2.1.0.7
26/06/2016 19.33.42 [_] INFO: CheckForUpdate()
ASF will automatically check for new versions every 24 hours
26/06/2016 19.33.42 [_] INFO: RefreshCMs()
Refreshing list of CMs...
26/06/2016 19.33.43 [_] INFO: RefreshCMs()
Success!
26/06/2016 19.33.43 [!!] ERROR: Load()
botDatabase is null!
26/06/2016 19.33.43 [!!] ERROR: .ctor() Bot database could not be loaded, refusing to start this bot instance!
26/06/2016 19.33.44 [_] INFO: Start() Starting...
26/06/2016 19.33.44 [_] INFO: OnConnected() Connected to Steam!
26/06/2016 19.33.44 [_] INFO: OnConnected() Logging in...
26/06/2016 19.33.45 [_] INFO: OnLoggedOn() Successfully logged on!
26/06/2016 19.33.46 [_] INFO: Init() Logging in to ISteamUserAuth...
26/06/2016 19.33.48 [_] INFO: Init() Success!
26/06/2016 19.33.49 [_] INFO: IsAnythingToFarm() Checking badges...
26/06/2016 19.33.49 [_] INFO: IsAnythingToFarm() Checking first page...
26/06/2016 19.33.51 [_] INFO: Start() Starting...
26/06/2016 19.33.51 [_] INFO: OnConnected() Connected to Steam!
26/06/2016 19.33.51 [_] INFO: OnConnected() Logging in...
26/06/2016 19.33.52 [_] INFO: OnLoggedOn() Successfully logged on!
26/06/2016 19.33.52 [_] INFO: StartFarming() We don't have anything to farm on this account!
26/06/2016 19.33.52 [_] INFO: Init() Logging in to ISteamUserAuth...
26/06/2016 19.33.52 [_] INFO: Init() Success!
26/06/2016 19.33.53 [_] INFO: IsAnythingToFarm() Checking badges...
26/06/2016 19.33.53 [_] INFO: IsAnythingToFarm() Checking first page...
26/06/2016 19.33.56 [_] INFO: StartFarming() We have a total of 5 games to farm on this account...
26/06/2016 19.33.56 [_] INFO: StartFarming() Chosen farming algorithm: Simple
26/06/2016 19.33.56 [_] INFO: FarmSolo() Now farming: 400250
26/06/2016 19.33.59 [_] INFO: ShouldFarm() Status for 400250: 4 cards remaining
26/06/2016 19.33.59 [*] INFO: Farm() Still farming: 400250
26/06/2016 19.36.07 [!] EXCEPTION: UnhandledExceptionHandler()
Object reference not set to an instance of an object.
StackTrace:
at ArchiSteamFarm.Bot.b__64_0(Bot bot)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at ArchiSteamFarm.Bot.d__64.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__82.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at ArchiSteamFarm.Bot.d__96.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

26/06/2016 19.33.43 [!!] ERROR: .ctor() Bot database could not be loaded, refusing to start this bot instance!

As I initially thought, thanks for reporting this!

You should fix your bot database, while I'll fix the issue that can happen when ASF adds Bot with broken database to Dictionary.

The bug should be fully fixed since V2.1.1.1 - https://github.com/JustArchi/ArchiSteamFarm/releases/tag/2.1.1.1

It won't magically fix your broken database, but ASF will no longer crash when bot with such database is used.

Thank you for report! :+1:

Any idea about how database can become broken? Any precautions about how to avoid it?

I'm not even sure how it's possible under normal conditions to catch broken database - I'm using ASF since version V0.1 24/7 on my server and I'm yet to face this issue. My theory is mainly about too aggressive AV scanning files being written on the go, and OS denying ASF permission to write. It's not possible under normal operation to catch it, it takes less than 100ms to write the file. You'd need to be super lucky to catch power outage or OS crash, and even in this case, the data that has to be written is so small that it should fill fully in the I/O buffer, so you'd end up with either old data or new one, not corrupted one.

I also can't believe in JsonConvert generating invalid JSON when ASF saves the file, this is not possible, because we had to use different structure for loading and saving to cause incompatibility, which is not the case with current code. Serialized object with given set of properties and settings must load properly from the same data.

So that leads to the question, what is the exact reason for ASF to catch such problem? No clue, I'm not even entirely sure how to harden it a bit, I think I'll just add some extra retry logic to file saving, because that is the only thing which crosses my mind.

This is the only thing which is possible for me to do. If despite our 5 tries and verifying that json is not-null, we will fail, there is really nothing more we can do. ASF can't operate without write access.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Revadike picture Revadike  路  3Comments

light444 picture light444  路  3Comments

ludo237 picture ludo237  路  3Comments

ttrl picture ttrl  路  3Comments

tambry picture tambry  路  4Comments