JustArchiNET / ArchiSteamFarm

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

The WebAPI call timed out #222

Closed il-marc closed 8 years ago

il-marc commented 8 years ago

For some reason I cant start any account with ASF 2.

08.05.2016 14:50:11 [*] INFO: CheckForUpdate() <Main> Checking new version...
08.05.2016 14:50:11 [*] INFO: CheckForUpdate() <Main> Local version: 2.0.4.3 | Remote version: 2.0.4.1
08.05.2016 14:50:11 [*] INFO: RefreshCMs() <Main> Refreshing list of CMs...
08.05.2016 14:50:12 [*] INFO: RefreshCMs() <Main> Success!
08.05.2016 14:50:12 [*] INFO: Start() <a_primary> Starting...
08.05.2016 14:50:12 [*] INFO: OnConnected() <a_primary> Connected to Steam!
08.05.2016 14:50:12 [*] INFO: OnConnected() <a_primary> Logging in...
08.05.2016 14:50:13 [*] INFO: OnLoggedOn() <a_primary> Successfully logged on!
08.05.2016 14:50:13 [*] INFO: Init() <a_primary> Logging in to ISteamUserAuth...
08.05.2016 14:50:33 [!] EXCEPTION: Init() <a_primary> The WebAPI call timed out
08.05.2016 14:50:33 [!] StackTrace:
   в SteamKit2.WebAPI.Interface.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
   в CallSite.Target(Closure , CallSite , Object , UInt64 , String , String , String , Boolean )
   в System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
   в ArchiSteamFarm.ArchiWebHandler.Init(SteamClient steamClient, String webAPIUserNonce, String parentalPin)
08.05.2016 14:50:34 [*] INFO: Init() <a_primary> Logging in to ISteamUserAuth...
08.05.2016 14:50:54 [!] EXCEPTION: Init() <a_primary> The WebAPI call timed out
08.05.2016 14:50:54 [!] StackTrace:
   в SteamKit2.WebAPI.Interface.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
   в CallSite.Target(Closure , CallSite , Object , UInt64 , String , String , String , Boolean )
   в ArchiSteamFarm.ArchiWebHandler.Init(SteamClient steamClient, String webAPIUserNonce, String parentalPin)

OS: WIn 8.1 x64. As I understend, on this step ASF is calling /ISteamUserAuth/AuthenticateUser/v1 for cookies. But with fiddler I dont see this call.

UPD: bot.json

{
  "Enabled": true,
  "SteamLogin": "user",
  "SteamPassword": "pass",
  "AcceptGifts": true,
  "SteamMasterClanID": 10xxxxxxxxxxxxxxxx,
  "SteamMasterID": 76xxxxxxxxxxxxxxx, 
  "AcceptGifts": true,
}

ASF.json

{
  "Debug": false,
  "AutoUpdates": false,
  "UpdateChannel": 1,
  "SteamProtocol": 6,
  "SteamOwnerID": 76xxxxxxxxxxxxxxx,
  "MaxFarmingTime": 10,
  "IdleFarmingPeriod": 3,
  "FarmingDelay": 15,
  "AccountPlayingDelay": 30,
  "LoginLimiterDelay": 25,
  "InventoryLimiterDelay": 3,
  "ForceHttp": false,
  "HttpTimeout": 60,
  "WCFHostname": "localhost",
  "WCFPort": 1242,
  "LogToFile": true,
  "Statistics": false,
  "HackIgnoreMachineID": false,
  "Blacklist": [
    267420,
    303700,
    335590,
    368020,
    425280
  ]
}
il-marc commented 8 years ago

My bad. There was other steamkit app running at same time.

il-marc commented 8 years ago

Again same problem. No other steamkit instances was running. Looks like steam bug.

il-marc commented 8 years ago

Mistery continues. I have removed all bots from config folder (about 130) except 6. And asf starts normaly. After adding one more bot in config folder got "The WebAPI call timed out" again. Asf 2.0.0.4 works fine

JustArchi commented 8 years ago

Perhaps you should increase LoginLimiterDelay or HttpTimeout. Nothing changed between that version and current one apart of some default values for those two.

There's also nothing to fix as ASF is on Steam Network's mercy.

il-marc commented 8 years ago

I have tested as much versions as can. Last working for me version is 2.0.1.2. Latest versions just freezing on this step. In the luckiest case it recieves weblogin not faster then 30 seconds, in other cases just failing

JustArchi commented 8 years ago

https://github.com/JustArchi/ArchiSteamFarm/compare/2.0.1.2...2.0.1.3

Nothing considering ArchiWebHandler changed.

Probably it's either temporary Steam problem, or they changed something recently that broke API call for more accounts.

JustArchi commented 8 years ago

You could make use of ForceHttp and check yourself with Wireshark or Fiddler if there is anything different between those two calls that would make it more prone to problems.

If the API was handled by my WebBrowser, I could point some possible culprits, but because API is entirely built-in SK2, there's no reason why it should suddenly start failing. I didn't hear from others users about similar problems as well.

As I said, consider tweaking LoginLimiterDelay and HttpTimeout. It's quite possible that Steam just got more restrictive since last time.

il-marc commented 8 years ago

Noticed strange thing

08.05.2016 18:23:58 [*] INFO: CheckForUpdate() <Main> Checking new version...
08.05.2016 18:23:59 [*] INFO: CheckForUpdate() <Main> Local version: 2.0.4.1 | Remote version: 2.0.4.1
08.05.2016 18:23:59 [*] INFO: RefreshCMs() <Main> Refreshing list of CMs...
08.05.2016 18:23:59 [*] INFO: RefreshCMs() <Main> Success!
08.05.2016 18:23:59 [*] INFO: Start() <a_primary> Starting...
08.05.2016 18:24:00 [*] INFO: OnConnected() <a_primary> Connected to Steam!
08.05.2016 18:24:00 [*] INFO: OnConnected() <a_primary> Logging in...
08.05.2016 18:24:01 [*] INFO: OnLoggedOn() <a_primary> Successfully logged on!
08.05.2016 18:24:01 [*] INFO: Init() <a_primary> Logging in to ISteamUserAuth...
08.05.2016 18:24:26 [*] INFO: Start() <generated_11> Starting...
08.05.2016 18:24:27 [*] INFO: Init() <a_primary> Success!
08.05.2016 18:24:27 [*] INFO: OnConnected() <generated_11> Connected to Steam!
08.05.2016 18:24:27 [*] INFO: OnConnected() <generated_11> Logging in...
08.05.2016 18:24:27 [*] INFO: IsAnythingToFarm() <a_primary> Checking badges...
08.05.2016 18:24:27 [*] INFO: IsAnythingToFarm() <a_primary> Checking first page...
08.05.2016 18:24:28 [*] INFO: OnLoggedOn() <generated_11> Successfully logged on!
08.05.2016 18:24:28 [*] INFO: Init() <generated_11> Logging in to ISteamUserAuth...
08.05.2016 18:24:30 [*] INFO: Init() <generated_11> Success!
08.05.2016 18:24:30 [*] INFO: IsAnythingToFarm() <generated_11> Checking badges...
08.05.2016 18:24:30 [*] INFO: IsAnythingToFarm() <generated_11> Checking first page...

According fiddler, request was send at 18:24:26

2016-05-08 18 25 47

il-marc commented 8 years ago

If I enable less bots its freezing less

JustArchi commented 8 years ago

Probably it freezes here - https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/WebAPI/WebAPI.cs#L295

I suspect it might be because SK2 devs are not setting proxy - https://social.msdn.microsoft.com/Forums/en-US/a00dba00-5432-450b-9904-9d343c11888d/webclient-downloadstringasync-freeze-my-ui?forum=ncl

This makes sense because it's not request being slow, but logic before sending it.

However, that is out of the scope of ASF, because method is used properly and logic relies on SK2. You might want to test it further in your own SK2 projects and report to SK2 devs if you think it's a bug that should be fixed. I couldn't reproduce that problem, neither got similar calls from other users.

JustArchi commented 8 years ago

As a side note, even with that issue, it should be enough for you to increase HttpTimeout to something higher like 90 if you don't want to bother with finding the real culprit in SK2 code.

Pandiora commented 8 years ago

I couldn't reproduce that problem, neither got similar calls from other users

Well, same here. If I'm using less bots its working and it looks like Steam changed something lately. Even the 2.0.1.1 I'm using has the same problems with "WebAPI Call timed out". Increasing the HttpTimeout or LoginLimiterDelay doesn't help.

The good thing about the older versions (2.0.1.1) is, that they doesn't disconnect all bots simultaneously and most of the bots stay connected. But getting cards from bots or redeeming gifts is impossible currently. Um, the MachineIDHack also doesn't help btw.

JustArchi commented 8 years ago

Most bots stay connected because in older version failure of refresh sessionID was non-fatal, while now it's considered fuckup (if failed 5 times) and bot instance is reconnected in order to refresh session entirely.

Even if it's non-fatal in older version, it doesn't mean that it's working - it's not. Bot can't check status of farmed game, and will keep farming it until it reaches 10 hours of timeout. This is NOT appropriate, as it's fuckup that should be caught (and corrected) earlier - this is what is happening with new code.

I don't consider it a bug - it's probably one of Valve limitations, and unless somebody finds out what limitation it is exactly I'm not interested in finding myself as I don't have that problem. If it's something easy such as X API calls per Y seconds, I could do that the same as I did with login limiter delay or inventory delay. Although it seems kinda silly to me that login limiter delay doesn't help, because it should considering session refreshes are limited to 1 initial one + as many needed ones due to primary account support (which is 0 in case of unused alts).

JustArchi commented 8 years ago

Another possible solution would probably involve ditching built-in SK2 way of accessing Steam API (which is not that great) and moving logic to ASF WebBrowser but that should be rather last thing to do, after finding out about Valve API limitations AND reporting bugs back to SK2 guys. If it's Valve API limitation - there should be proper ASF logic limiting API access (and I can do that if you find out what the limit is), if that's WebAPI SK2 bug - it should be reported to SK2 devs. If nothing else works, we could try to move that one API call to ASF WebBrowser to see if that helps, but I'd prefer to keep it as it is considering it works.

Pandiora commented 8 years ago

Well I think you know there are lots of bug-reports and there are already 3 issues related to these timeouts: https://github.com/SteamRE/SteamKit/issues/236

Someone mentioned to use 1.6.4 or 1.6.5 of SK2. The problem here is that you're using methods that were implemented with 1.7.0, so I can't test this scenario w/o rewriting lots of code.

Currently the bot runs stable. Sometimes 1-10 bots disconnect but will connect again after some time. (Mono 4.2.3.4/Stable) 2 ASF-Instances are using ~1GB RAM. I can't remember ASF needed so much ressources but with 2.0.1.1 there are less CPU-Usage and -Spikes.

tl;dr: Farming works and the most of the bots stay online all the time until they try to use the WebAPI. I could try to reproduce this locally later/tomorrow.

JustArchi commented 8 years ago

That has nothing to do with your issue. The above is for connecting to steam CM and has been resolved since ages.

Pandiora commented 8 years ago

Hm, just an addition: !loot works w/o throwing errors.