View Issue Details

IDProjectCategoryView StatusLast Update
0007500Multi Theft Auto : San AndreasServerpublic2013-02-07 20:55
ReporterWarlordPrexeonAssigned Tosbx320 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target Version1.3.2Fixed in Version1.3.2 
Summary0007500: setAccountData / getAccountData
Description

the issue happens when i add a new account using "addAccount" then try to set that account's data with "setAccountData", what happens is the accounts gets added to the database file with an "id" and their account data gets added with another "userid", that will make "getAccountData" always return false

PS1: it was fine weeks ago
PS2: "getAccountData" returns false after the server restarts, it works fine until server stops

Steps To Reproduce

1: delete all accounts by deleting internal.db
2: register an account in the server,delete it and re-register it and set his account data
3: check the internal.db file with sqlitebrowser u will find the "id" and "userid" are different
4: try to use getAccountData after restarting the server it will return false
5: manually edit the "id" in accounts table in internal.db file to be the same as "userid" in the userdata table
6: retry getAccountData it will return true

Additional Information

THIS WILL HAPPEN ONLY AFTER DELETING AN ACCOUNT, THIS WILL KEEP HAPPENING UNTIL SERVER FILES ARE RE-INSTALLED OR PC RESTARTED ( as i tried )

TagsNo tags attached.

Activities

sbx320

2013-02-07 02:24

administrator   ~~0018115

The reason for this issue seems to be CAccount and the SQLite Database (internal.db) getting out of sync with userids.
CAccountManager::Save uses INSERT OR IGNORE INTO accounts, effectively using SQLite's AUTO_INCREMENT. This will use the last ever occupied userid +1 as new user id.
CAccountManager::Register uses ++m_iAccounts to determine the id of the newly created account. This will be the amount of accounts +1.

Usually both values should be the same, but in case of a deletion they may get out of sync as described above, as the total number of accounts no longer matches the internal AUTO_INCREMENT-counter.

Patch: http://sbx320.v220120813617898099.yourvserver.net/Issue_7500_CAccountManager.cpp.patch

ccw

2013-02-07 05:15

administrator   ~~0018116

Fixed in http://code.google.com/p/mtasa-blue/source/detail?r=5004

Thanks for the patch.
Please test in next nightly. (r5005 in 1.3)

Issue History

Date Modified Username Field Change