koraktor / steam-condenser

A multi-language library for querying the Steam Community, Source, GoldSrc servers and Steam master servers
https://koraktor.de/steam-condenser
Other
359 stars 66 forks source link

Error fetching playerdata + caching-problem? #16

Closed ccondrup closed 14 years ago

ccondrup commented 15 years ago

I am building a script to query our gameservers, currently 10 servers. The script selects which servers to update, and then launches steam-condenser to fetch info for each of the selected servers. I have been running this script without problems for a few days now, suddenly got an error (none of my code changed). I ran the script with param to query server #1, and got this error: Notice: Undefined index: (1)Lucky strikeeee in steam-condenser/lib/steam/servers/GameServer.php on line 235 Fatal error: Call to a member function addInformation() on a non-object in steam-condenser/lib/steam/servers/GameServer.php on line 235 I did a git clone of the php version yesterday, so this is on fresh condenser code.

  1. So, I haven't been able to pinpoint exactly when this happens, but I think it might be because the player leaves or changes name in the middle of Condensers fetching. The code I use has worked for days, suddenly it gives this error.
  2. Then I run the script again but connect to another server, our server #2. I get the exact same error (Undefined index: (1)Lucky strikeeee). So I wait for 15 minutes, run the script again on #2, and still get that same error. Can this be a caching error in Condenser? If cond. fails on one player index, that index is not unset/purged before next run?

Let me know if you want me to send you the php source code for my script.

ccondrup commented 15 years ago

I also see some players having a blank steamid. Would it not be useful to return STEAM_ID_PENDING if that's what they actually have at the time of query, instead of blank/nothing? Is blank the expected behaviour? I see that the last player who had blank steamid had connectTime == 0.

Okey, this same player came back again and again so I got a lot more info on him: He kept timing out of the server, he was listed as a spectator, but did not show up as a player in the status list. A typical "ghost". He reconnected a bunch of times, and when he finally did join a team he was soon after kicked for very high ping. At this time he did show up in status.

So, somewhere along the line, he was seen by condenser but kept timing out/reconnecting and hence ended up with a blank getSteamid() from condenser. Maybe add a regex check to condenser to be sure to either return a valid SteamID, or if not return an error or set string such as the PENDING mentioned above.

koraktor commented 15 years ago

As you have already noticed, this is a bug in "caching". Steam Condenser fetches the players using the standard query first and after that adds the additional information collected using rcon status. There will always be a small time difference between the two queries and if I recall right, I considered this problem before. But it looks like my solution isn't 100% safe.

I'll take a look at this.

koraktor commented 15 years ago

I just committed a small patch in b0feb880ed08121c6f104f325cf0825ae92a47ba. This fixes the errors, but not the fundamental problem.

I don't believe there's a 100% safe way to get player information using two separate queries (additionally using different protocols). There's always at least a slight chance that you'll get different data with the second query.

koraktor commented 14 years ago

As said before this probably will never be fixed as long as Valve does not fundamentally change the query protocol.