JustArchiNET / ArchiSteamFarm

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
Apache License 2.0
10.92k stars 1.04k forks source link

DuplicateRequest Exception from ArchiHandler.GetMyInventoryAsync #3174

Closed Citrinate closed 3 months ago

Citrinate commented 3 months ago

Checklist

ASF version

Latest pre-release

ASF variant

generic (with latest .NET runtime)

Bug description

ArchiHandler.GetMyInventoryAsync sometimes throws an exception

Expected behavior

No errors or error handling

Actual behavior

System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest

Steps to reproduce

  1. Send command unpack asf
  2. Wait until command finishes
  3. Send command unpack asf again
  4. Repeat until error

Just using unpack asf as an easy way to call ArchiHandler.GetMyInventoryAsync here. My inventories have no booster packs in them. This can also be reproduced by sending the command to a single bot instead of all bots, ex: unpack BotA

Possible reason/solution

No response

Can you help us with this bug report?

No, I don't have time, skills or willings for any of that

Full log.txt recorded during reproducing the problem

Mar 27 11:08:04 asf-asf[933881]: INFO|ASF|InitCore() ArchiSteamFarm-custom V6.0.1.17 (source/5ad1439cf80e4f94bf886b424cc3a67b | .NET 8.0.3; arch-x64; Arch Linux) in [/var/lib/asf]
Mar 27 11:08:04 asf-asf[933881]: INFO|ASF|InitCore() Copyright © 2015-2024 JustArchiNET
Mar 27 11:08:04 asf-asf[933881]: WARN|ASF|Load() Your IPC password seems to be weak. Consider choosing a stronger one for increased security. Details: Add another word or two.  Uncommon words are better.
Mar 27 11:08:04 asf-asf[933881]: INFO|ASF|Start() Starting IPC server...
Mar 27 11:08:05 asf-asf[933881]: INFO|Microsoft.Hosting.Lifetime|Now listening on: http://localhost:1242
Mar 27 11:08:05 asf-asf[933881]: INFO|Microsoft.Hosting.Lifetime|Application started. Press Ctrl+C to shut down.
Mar 27 11:08:05 asf-asf[933881]: INFO|Microsoft.Hosting.Lifetime|Hosting environment: Production
Mar 27 11:08:05 asf-asf[933881]: INFO|Microsoft.Hosting.Lifetime|Content root path: /usr/lib/asf/
Mar 27 11:08:05 asf-asf[933881]: INFO|ASF|Start() IPC server ready!
Mar 27 11:08:05 asf-asf[933881]: INFO|BotD|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotB|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotA|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotC|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|citrinate|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotE|Start() Starting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotE|Connect() Connecting...
Mar 27 11:08:05 asf-asf[933881]: INFO|BotE|OnConnected() Connected to Steam!
Mar 27 11:08:05 asf-asf[933881]: INFO|BotE|OnConnected() Logging in...
Mar 27 11:08:06 asf-asf[933881]: INFO|BotE|OnLoggedOn() Successfully logged on as x.
Mar 27 11:08:06 asf-asf[933881]: INFO|BotE|Init() Success!
Mar 27 11:08:15 asf-asf[933881]: INFO|BotD|Connect() Connecting...
Mar 27 11:08:15 asf-asf[933881]: INFO|BotD|OnConnected() Connected to Steam!
Mar 27 11:08:15 asf-asf[933881]: INFO|BotD|OnConnected() Logging in...
Mar 27 11:08:15 asf-asf[933881]: INFO|BotD|OnLoggedOn() Successfully logged on as x.
Mar 27 11:08:15 asf-asf[933881]: INFO|BotD|Init() Success!
Mar 27 11:08:16 asf-asf[933881]: INFO|BotD|IsAnythingToFarm() Checking first badge page...
Mar 27 11:08:17 asf-asf[933881]: INFO|BotD|StartFarming() We don't have anything to farm on this account!
Mar 27 11:08:25 asf-asf[933881]: INFO|citrinate|Connect() Connecting...
Mar 27 11:08:25 asf-asf[933881]: INFO|citrinate|OnConnected() Connected to Steam!
Mar 27 11:08:25 asf-asf[933881]: INFO|citrinate|OnConnected() Logging in...
Mar 27 11:08:26 asf-asf[933881]: INFO|citrinate|OnLoggedOn() Successfully logged on as x/Citrinate.
Mar 27 11:08:26 asf-asf[933881]: INFO|citrinate|Init() Success!
Mar 27 11:08:27 asf-asf[933881]: INFO|citrinate|IsAnythingToFarm() Checking first badge page...
Mar 27 11:08:27 asf-asf[933881]: INFO|citrinate|IsAnythingToFarm() Checking other badge pages...
Mar 27 11:08:29 asf-asf[933881]: INFO|citrinate|StartFarming() We don't have anything to farm on this account!
Mar 27 11:08:35 asf-asf[933881]: INFO|BotA|Connect() Connecting...
Mar 27 11:08:35 asf-asf[933881]: INFO|BotA|OnConnected() Connected to Steam!
Mar 27 11:08:35 asf-asf[933881]: INFO|BotA|OnConnected() Logging in...
Mar 27 11:08:35 asf-asf[933881]: INFO|BotA|OnLoggedOn() Successfully logged on as x.
Mar 27 11:08:35 asf-asf[933881]: INFO|BotA|Init() Success!
Mar 27 11:08:36 asf-asf[933881]: INFO|BotA|IsAnythingToFarm() Checking first badge page...
Mar 27 11:08:37 asf-asf[933881]: INFO|BotA|StartFarming() We don't have anything to farm on this account!
Mar 27 11:08:45 asf-asf[933881]: INFO|BotC|Connect() Connecting...
Mar 27 11:08:45 asf-asf[933881]: INFO|BotC|OnConnected() Connected to Steam!
Mar 27 11:08:45 asf-asf[933881]: INFO|BotC|OnConnected() Logging in...
Mar 27 11:08:45 asf-asf[933881]: INFO|BotC|OnLoggedOn() Successfully logged on as x.
Mar 27 11:08:45 asf-asf[933881]: INFO|BotC|Init() Success!
Mar 27 11:08:46 asf-asf[933881]: INFO|BotC|IsAnythingToFarm() Checking first badge page...
Mar 27 11:08:47 asf-asf[933881]: INFO|BotC|StartFarming() We don't have anything to farm on this account!
Mar 27 11:08:55 asf-asf[933881]: INFO|BotB|Connect() Connecting...
Mar 27 11:08:55 asf-asf[933881]: INFO|BotB|OnConnected() Connected to Steam!
Mar 27 11:08:55 asf-asf[933881]: INFO|BotB|OnConnected() Logging in...
Mar 27 11:08:55 asf-asf[933881]: INFO|BotB|OnLoggedOn() Successfully logged on as x.
Mar 27 11:08:55 asf-asf[933881]: INFO|BotB|Init() Success!
Mar 27 11:08:56 asf-asf[933881]: INFO|BotB|IsAnythingToFarm() Checking first badge page...
Mar 27 11:08:56 asf-asf[933881]: INFO|BotB|StartFarming() We don't have anything to farm on this account!
Mar 27 11:09:08 asf-asf[933881]: WARN|citrinate|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]: WARN|BotA|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]: WARN|BotC|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]: WARN|BotD|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]: WARN|BotE|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]: WARN|BotB|ResponseUnpackBoosters() System.Net.Http.HttpRequestException: Failed due to error: DuplicateRequest
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+MoveNext()
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Integration.ArchiHandler.GetMyInventoryAsync(UInt32 appID, UInt64 contextID, Boolean tradableOnly, Boolean marketableOnly, UInt16 itemsCountPerRequest)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncEnumerable.WhereEnumerableAsyncIterator`1.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Where.cs:line 233
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70
Mar 27 11:09:08 asf-asf[933881]:    at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)
Mar 27 11:09:08 asf-asf[933881]:    at ArchiSteamFarm.Steam.Interaction.Commands.ResponseUnpackBoosters(EAccess access)

Global ASF.json config file

No response

BotName.json config of all affected bot instances

No response

Additional info

In regards to what I described here: https://github.com/Citrinate/BoosterManager/commit/d68141d1ae0cb6294de21706fd0efa1dd8522ceb#commitcomment-140273865

I wasn't running commands then as quickly as I'm doing here to get this error. Though in my testing here, I was able to get an error on one occasion after sending only 2 unpack asf commands since logging on; so it's possible that maybe I was for a brief period.

I'll continue testing to see if I get any more errors.

JustArchi commented 3 months ago

You have 6 exceptions, but only 4 bots. Didn't you send unpack ASF two times at once?

JustArchi commented 3 months ago

Ah okay, now I see, there are 6, so each bot threw that exception.

The question stands however, are you sure there weren't two consecutive fetch requests? If not, how many items in inventory those accounts have, more than 5k?

Citrinate commented 3 months ago

I've only been able to reproduce this error when I make 2 or more fetches in quick succession. The less time between fetches, the more likely there will be an error. The number of items in each of these inventories is: 448, 79, 34, 34, 35, and 663.

The chat that produced the log above is:

[11:09 AM] Citrinate: !status asf

[11:09 AM] BotA:
    <citrinate> Bot is not farming anything.
    <BotA> Bot is not farming anything.
    <BotB> Bot is not farming anything.
    <BotC> Bot is not farming anything.
    <BotD> Bot is not farming anything.
    <BotE> Bot is paused or running in manual mode.There are 6/6 bots running, with total of 0 games (0 cards) left to farm.

[11:09 AM] Citrinate: !unpack asf

[11:09 AM] BotA: <citrinate> Success!
    <BotA> Success!
    <BotB> Success!
    <BotC> Success!
    <BotD> Success!
    <BotE> Success!

[11:09 AM] Citrinate: !unpack asf

[11:09 AM] BotA: <citrinate> Done!
    <BotA> Done!
    <BotB> Done!
    <BotC> Done!
    <BotD> Done!
    <BotE> Done!
JustArchi commented 3 months ago

Okay, that explains everything, could you check how much time you need before it starts working again? Roughly, in seconds, before you get at least one success, since the moment it stops working.

Citrinate commented 3 months ago

It never stops working completely, it's just that individual fetches may fail. If one fails, the next one usually succeeds.

For example, if I make one request every second I might see a string of: Success, Success, Fail, Success, Fail, Success, Success.

I haven't seen any fails when I test 1 fetch every 5 seconds either from my 79 item bot or my 663 item bot.

JustArchi commented 3 months ago

Great, that's very valuable info, thanks a lot, I should be able to make the method more robust now. Will do that and then release new version for you to test :+1:

JustArchi commented 3 months ago

I've marked V6.0.1.18 for release with this fix. If you'll get any further issues with the new method let me know. It seems we need similar level of bulletproofing as old AWH method, that simply already has it implemented by me before (sigh).