-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] empty Steam IDs in DB / 'STEAM_ID_STOP_IGNORING_RETVALS' in playerrank #549
Comments
I have done some testing with OnClientPostAdminCheck and the EDIT: public void OnClientPostAdminCheck(int client)
{
char szSteamId64[32];
if ( !GetClientAuthId(client, AuthId_SteamID64, szSteamId64, sizeof(szSteamId64), true) )
ReconnectClient(client);
.......
} |
That sounds strange to me. As far as I understood, you get If, however, you wait for either I have done some testing too, I moved the GeoIP lookup and storing the steam ID to |
* Small timer improvements Delete old BeamBoxAll timer before we start a new one Merged some timers into one instead of multiple timers with the same interval * Remove unused touch callbacks * Ignore dead players without Alive check, okay? * Readability * Unhook is not necessary * PreThink should be enough, i think * Get rid of (not really necessary) GetClientAuthId * Loop OnClientPutInServer until it's valid... maybe we should add a spam protection? * Check for "STEAM_ID_STOP_IGNORING_RETVALS" ( #549 ) * Better callback names and spoiler for my next step 👀 * Remove invalid table rows with... the steamid "STEAM_ID_STOP_IGNORING_RETVALS" * Remove invalid table rows with... the steamid "STEAM_ID_STOP_IGNORING_RETVALS"
now bots are not working after this update. it's show dark place from bots view |
Observed behaviour
We've had playerrank entries with empy
steamid
and asteamid64
ofSTEAM_ID_STOP_IGNORING_RETVALS
. If you google that, you find that this is a value thatGetClientAuthId()
returns as a steam ID when it fails to look up a player's steam ID.You also find that you should never use
GetClientAuthId()
without checking it's return value -- it can befalse
if it fails to look up the player's steam ID. In other words:This is bad:
This is good:
Because the timer does it the bad way, it'll happily write an empty steam ID and the 'stop ignoring' string as steamid64 into the DB.
Obviously, this can be fixed by checking the retval, but the real question is, why would it fail to retrieve the steam ID in the first place and what can be done about it?
I've been debugging a lot and think I have figured it out:
Cause for the bug
When a player connects, this
OnClientPutInServer
forward function in surftimer will be called. At the end in L498, it callsLoadClientSetting()
after settingg_iSettingToLoad[client]
to 0. From there, the respective setting is being loaded andg_iSettingToLoad[client]
is ++'d, this repeats until it has looped through all "settings" that need loading.One of these "load a setting" functions that
LoadClientSetting()
calls isdb_viewPlayerPoints()
. It retrieves stats like time alive, time in spec etc. fromck_playerrank
. If no results are returned because it's a new player, its callback will runGetClientAuthId()
to retrieve the player's steamid64 and then create ack_playerrank
profile for this player:SurfTimer/addons/sourcemod/scripting/surftimer/sql.sp
Lines 1533 to 1537 in dfdd356
So this is where the wrong DB entries come from, and by tracing back from here, I found it is initially caused by the
OnClientPutInServer
forward.Sourcemod says this about OnClientPutInServer:
I have added some debug logging for
OnClientAuthorized
, and indeed, in one particular case theOnClientAuthorized
happened 85 seconds after the actual player connect (where the timer created a playerrank profile withSTEAM_ID_STOP_IGNORING_RETVALS
as steamid64). It seems to work 99% of the time, but there's still that one percent where maybe steam ID servers are slow to respond or something, and then this happens.Possible solution
Because functions called in this forward rely on knowing a player's steam ID, I think it should not be used. It is suggested to use
OnClientPostAdminCheck
instead, which is...So I think fixing this is as easy as replacing
public void OnClientPutInServer(int client)
by
public void OnClientPostAdminCheck(int client)
here:
SurfTimer/addons/sourcemod/scripting/SurfTimer.sp
Line 431 in 4afec45
Does that sound like a good idea?
The text was updated successfully, but these errors were encountered: