Skip to content
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

Database corruption in darkrp_player #2466

Closed
MStruntze opened this issue Jun 4, 2016 · 8 comments
Closed

Database corruption in darkrp_player #2466

MStruntze opened this issue Jun 4, 2016 · 8 comments

Comments

@MStruntze
Copy link
Contributor

Description of the bug

As mentioned in #2459 there's an issue somewhere causing database corruption.
After a new database, it only took 4 days before the database corrupted again.
Fortunately Bo98 made it actually show the issue now in the error.
Before this occured the player accused someone else of using his name. I tried replicating this but was unable to find the exact cause.
As shown in the error, this is the issue, the rpname is not unique.
Here's the error:

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/modules/base/sv_data.lua" on line 427.
The best help I can give you is this:

Failed to retrieve player information from the database. 

Hints:
    - This means your database or the connection to your database is fucked.
    - This is the error given by the database:
        column rpname is not unique

The responsibility for the error above lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 427
    2. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 313
    3. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 299
    4. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 243
    5. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 287
    6. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 304
    7. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 267
    8. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 312
    9. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 313
    10. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 299
    11. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 243
    12. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 287
    13. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 304
    14. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 267
    15. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 312
    16. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 313
    17. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 299
    18. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 243
    19. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 287
    20. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 304
    21. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 267
    22. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 312
    23. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 313
    24. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 299
    25. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 243
    26. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 287
    27. gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua on line 304
    28. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 267
    29. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 312
    30. gamemodes/darkrp/gamemode/modules/base/sv_data.lua on line 399
    31. gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua on line 587
------- End of Simplerr error -------

  1. error - [C]:-1
   2. error - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
    3. retrievePlayerData - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:427
     4. errorCallback - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:313
      5. query - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:299
       6. queueQuery - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:243
        7. callback - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:287
         8. query - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:304
          9. offlinePlayerData - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:267
           10. retrievePlayerData - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:312
            11. errorCallback - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:313
             12. query - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:299
              13. queueQuery - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:243
               14. callback - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:287
                15. query - gamemodes/darkrp/gamemode/libraries/mysqlite/mysqlite.lua:304
                 16. offlinePlayerData - gamemodes/darkrp/gamemode/modules/base/sv_data.lua:267


[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua" on line 384.
The best help I can give you is this:

There is a player with an invalid team!

The player's name is Gunter, their team number is "1001", which has the name "Unassigned"

Hints:
    - It is the server owner's responsibility to figure out why that player has no valid team.
    - This error is very likely to be caused by an earlier error. If you don't see any errors in your own console, look at the server console.

The responsibility for the error above lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua on line 384
    2. gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua on line 711
------- End of Simplerr error -------

  1. error - [C]:-1
   2. error - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
    3. getJobTable - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:384
     4. unknown - gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua:711


[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua" on line 384.
The best help I can give you is this:

There is a player with an invalid team!

The player's name is Gunter, their team number is "1001", which has the name "Unassigned"

Hints:
    - It is the server owner's responsibility to figure out why that player has no valid team.
    - This error is very likely to be caused by an earlier error. If you don't see any errors in your own console, look at the server console.

The responsibility for the error above lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua on line 384
    2. gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua on line 469
    3. function 'Give'
    4. addons/cabr/lua/cabr/bank/sv_bank.lua on line 128
    5. addons/fruitydb/lua/fdb_queries.lua on line 161
    6. addons/fruitydb/lua/dbtypes/tmysql4.lua on line 67
    7. function 'fn'
    8. addons/sa_ulib/lua/ulib/shared/hook.lua on line 110
------- End of Simplerr error -------

  1. error - [C]:-1
   2. error - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
    3. getJobTable - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:384
     4. unknown - gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua:469
      5. Give - [C]:-1
       6. onSuccess - addons/cabr/lua/cabr/bank/sv_bank.lua:128
        7. onSuccess - addons/fruitydb/lua/fdb_queries.lua:161
         8. unknown - addons/fruitydb/lua/dbtypes/tmysql4.lua:67
          9. fn - [C]:-1
           10. unknown - addons/sa_ulib/lua/ulib/shared/hook.lua:110


[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua" on line 384.
The best help I can give you is this:

There is a player with an invalid team!

The player's name is Gunter, their team number is "1001", which has the name "Unassigned"

Hints:
    - It is the server owner's responsibility to figure out why that player has no valid team.
    - This error is very likely to be caused by an earlier error. If you don't see any errors in your own console, look at the server console.

The responsibility for the error above lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua on line 384
    2. addons/cabr/lua/cabr/darkrp/sv_darkrp.lua on line 46
    3. addons/cabr/lua/cabr/modelselector/sv_modelselector.lua on line 182
    4. addons/fruitydb/lua/fdb_queries.lua on line 176
    5. addons/fruitydb/lua/fdb_queries.lua on line 161
    6. addons/fruitydb/lua/dbtypes/tmysql4.lua on line 67
    7. function 'fn'
    8. addons/sa_ulib/lua/ulib/shared/hook.lua on line 110
------- End of Simplerr error -------

  1. fn - [C]:-1
   2. unknown - addons/sa_ulib/lua/ulib/shared/hook.lua:110

How to make the bug happen

unknown

Lua errors

posted above

Why the developer of DarkRP is responsible for this issue

you're the only one using that table

@MStruntze
Copy link
Contributor Author

@Shigbeard
Copy link
Contributor

Shigbeard commented Jun 4, 2016

nice, someone made a user-entered field uniqueid'd. That's like, databasing 101.

EDIT: Just UNIQUE, sorry, or a primary key if you will.

@FPtje
Copy link
Owner

FPtje commented Jun 4, 2016

Where the fuck are you getting that?

@Shigbeard
Copy link
Contributor

All you'd need to do is check if the steam name of a user not in the DB matches the rpname of someone who is. If so, add a (n of duplicate users) to the end of their name and voila... RP name.

@MStruntze
Copy link
Contributor Author

MStruntze commented Jun 4, 2016

Would another (maybe not perfect) solution be to make the uid field the only unique field?
I know that there should only be one with the same name, but if darkrp already has these checks in place to prevent duplicates, there's no need to have the database corrupting because the check is failing.
Of course the best solution would be to identify the problem causing duplicates to slip pass, but at least this would prevent the database from malfunctioning right?
This could also mean that you avoid adding those characters to the end of the name to prevent the field from being unique?
Or am I on the wrong path here?

@FPtje
Copy link
Owner

FPtje commented Jun 4, 2016

Changing these things in databases is always a pain.

@DBotThePony
Copy link
Contributor

As steam adds (number) at end of player nick when nick is not unique, i think DarkRP should do the same

@MStruntze
Copy link
Contributor Author

@roboderpy Or don't have the rpname field as unique?
But yea, your idea would help on those joining with a steam name which is already used.
Instead of adding some invisible chars - or however it's done now.

@FPtje FPtje closed this as completed in e23943b Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants