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

SQL_Callback Error: Incorrect string value #57

Open
crashzk opened this issue Apr 27, 2021 · 22 comments
Open

SQL_Callback Error: Incorrect string value #57

crashzk opened this issue Apr 27, 2021 · 22 comments

Comments

@crashzk
Copy link
Contributor

crashzk commented Apr 27, 2021

Doubt, I'm using the latest version of Levels Ranks Core that is on GitHub:

"[Levels Ranks] Core" (v3.1.6) by RoadSide Romeo & Wend4r

Full list of the plugin and modules I use:

  19 "[LR] Module - ExStats Weapons" (v3.1) by RoadSide Romeo & Wend4r
  20 "[LR] Module - ExStats Maps" (3.1 F1) by RoadSide Romeo
  21 "[LR] Module - Boost(Vip)" (v3.1.5) by Designed (Discord: .Designed#7985)
  22 <Failed> "[LR] Module - ExStats GeoIP" (v3.1) by RoadSide Romeo
  23 "[LR] Module - Overlays" (v3.1) by RoadSide Romeo
  24 "[LR] Module - TOP by KDR" (v3.1.5) by Wend4r
  25 "[LR] Module - ExStats Hits" (v3.1) by Wend4r
  26 "[LR] Module - Unusual Kills" (v3.1.6 SR2) by Wend4r
  69 "[Levels Ranks] Core" (v3.1.6) by RoadSide Romeo & Wend4r
Errors:
levels_ranks/levelsranks_exstats_geoip.smx ([LR] Module - ExStats GeoIP): Native "GeoipCity" was not found

I am always getting this error:

L 04/27/2021 - 10:08:12: [levelsranks.smx] SQL_Callback Error (15650): Incorrect string value: '\xF0\x9D\x92\x8C\xF0\x9D...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
L 04/27/2021 - 10:33:38: [levelsranks.smx] SQL_Callback Error (15794): Incorrect string value: '\xF0\x9F\x8C\xAE' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
L 04/27/2021 - 11:35:43: [levelsranks.smx] SQL_Callback Error (16002): Incorrect string value: '\xF0\x9F\x8C\xAE' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
L 04/27/2021 - 16:00:50: [levelsranks.smx] SQL_Callback Error (18850): Incorrect string value: '\xF0\x9D\x95\xAF$\xF0...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1
L 04/27/2021 - 16:13:44: [levelsranks.smx] SQL_Callback Error (18850): Incorrect string value: '\xF0\x9D\x95\xAF$\xF0...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1

Any way to fix this? What can it be?

I have already completely deleted the tables and created the databases again and nothing to solve the problem.

@crashzk
Copy link
Contributor Author

crashzk commented Apr 27, 2021

Duplicate Issues: #24

I'm leaving it open just to see if I can solve it and post the feedback here.

@Wend4r
Copy link
Member

Wend4r commented Apr 27, 2021

Link to alliedmodders/sourcemod#1150

@peace-maker
Copy link

Your name buffer is too small which leads to truncation of the name. If the name contained unicode multibyte characters and the last unicode character is cut off mid-bytes, you get the unicode errors reported above. Strings in SourcePawn are just character/byte arrays where one unicode character uses multiple bytes. There is API to check that if you ever need it - as you already use in that GetFixNamePlayer function.

Use MAX_NAME_LENGTH (128) when storing client names.
https://github.com/levelsranks/levels-ranks-core/blob/cf155d01f1f508e323d8e7293cbb50022ce412ac/Game%20Server/addons/sourcemod/scripting/levels_ranks/custom_functions.sp#L166-L168

And increase your database schema's name field to 128 as well to be safe. CS:GO was the first game to increase the buffer size from 32 characters to 128 to support up to 32 unicode characters => 32*4. I'm not sure if they restrict the name to max. 32 ascii chars or allow longer names, but you can test that quickly.

@Wend4r I've already tried to hint at a possible truncation problem in the issue you linked above. I see that the original reporter was sent from here - please consider reporting problems in SourceMod with your plugins yourself instead of proxying through a user of yours. We could have solved this 2 years ago! 🍻

@Wend4r
Copy link
Member

Wend4r commented Apr 28, 2021

@peace-maker, realized there might be a case where the last character becomes invalid due to byte truncation. Size 32 was written with the idea of other Source games in mind, but in CS:GO it's bigger. Thank you for your explanation.

Wend4r added a commit that referenced this issue Apr 28, 2021
Change the nickname size from 32 to MAX_NAME_LENGTH (Issue #57)
Wend4r added a commit that referenced this issue Apr 28, 2021
Change the nickname size from 32 to MAX_NAME_LENGTH (Issue #57)
@Wend4r
Copy link
Member

Wend4r commented Apr 28, 2021

@crashzk, please test 3.1.7 Beta 1

@crashzk
Copy link
Contributor Author

crashzk commented Apr 28, 2021

@crashzk, please test 3.1.7 Beta 1

I will be testing and returning with feedback.

Curiosity, I just update the plugin and test it, or would it be better to delete the Levels Ranks tables and start from scratch?

@Wend4r
Copy link
Member

Wend4r commented Apr 28, 2021

Not obligatory. Core itself will change the column varchar size for MySQL type work
https://github.com/levelsranks/levels-ranks-core/blob/7286ed2f38b9f7ee26a99e473a1967ed0695d6c4/Game%20Server/addons/sourcemod/scripting/levels_ranks/database.sp#L182-L183

@crashzk
Copy link
Contributor Author

crashzk commented Apr 28, 2021

@Wend4r forgot to send the compiled and when I try to compile the following error:

//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// levelsranks.sp
//
// D:\Google Drive\ZK ServidoresÖ\Servidores CSGO\Editar Plugins\addons\sourcemod\scripting\levelsranks.sp(44) : fatal error 194: user error: This plugin can only compile on lvl_ranks.inc v3.1.6.
//
//
// Compilation aborted.
// 1 Error.
//
// Compilation Time: 0,25 sec
// ----------------------------------------

Press enter to exit ...

@crashzk crashzk mentioned this issue Apr 28, 2021
@crashzk
Copy link
Contributor Author

crashzk commented Apr 29, 2021

@Wend4r I sent it and so far the problem still remains:

L 04/29/2021 - 00:00:52: SourceMod error session started
L 04/29/2021 - 00:00:52: Info (map "de_mirage") (file "/home/clientes/OGP_User_Files/whmcs/2057/csgo/addons/sourcemod/logs/errors_20210429.log")
L 04/29/2021 - 00:00:52: [levelsranks.smx] SQL_Callback Error (178): Incorrect string value: '\xF0\x9D\x99\x8D\xF0\x9D...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1

Table apparently updated, but the error continues.
image

image

I will check if after a reset in the database the problem continues.

Another thing I noticed, but I don’t know if it has to do with this problem, is that players that enter the nickname invisible, characters invisible rank doesn’t save their data, keeps showing the following message to them when they try to use any LR command:

[LR] You account is not loaded. Please reconnect on the server!

This error only stopped after he put a valid nickname on the stea and reconnected the server.

@Wend4r
Copy link
Member

Wend4r commented Apr 29, 2021

(╯°□°)╯︵ ┻━┻

@Wend4r
Copy link
Member

Wend4r commented Apr 29, 2021

Means
#57 (comment)

@peace-maker
Copy link

No, you should start debugging this first. Logging the failing queries which contain the name might be a good start. If you have a short reproducible test case you're welcome to reopen that issue.

@crashzk
Copy link
Contributor Author

crashzk commented Apr 29, 2021

I am resetting the database, and even deleting all of the table that has an empty name, the problem still occurs:

L 04/29/2021 - 07:45:17: [levelsranks.smx] SQL_Callback Error (1922): Incorrect string value: '\xF0\x9D\x99\x8D\xF0\x9D...' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1

Seeing the database there are no more character errors in the names of the players, everyone is right and they appear as they wrote.

I haven't tested it with the characters of this type: 𝐌𝐎𝐑𝐆𝐀𝐃𝐎 or 𝓼𝔁𝓵𝓽𝔂

I will use some of these characters to test and see if that would be the problem.

@crashzk
Copy link
Contributor Author

crashzk commented May 1, 2021

@Wend4r apparently I identified the problem, players that use nick with characters, strange that generate this error 👑𝓕𝓡𝓞𝓢𝓟 👑.

Player connected with this nick he did not have access to the rank and did not even update his rank, he tried to use the command !lvl and showed him the following error:

[LR] You account is not loaded. Please reconnect on the server!

Even leaving emojis just doesn't work, it was only when he wrote the normal nickname, frosp.

You can't even have emojis from what I noticed.

Any way to fix this?

@Wend4r
Copy link
Member

Wend4r commented May 1, 2021

Any way to fix this?

#57 (comment)

or enter "0" for "lr_db_allow_utf8mb4", since your database is incompatible with SourceMod MySQL Driver with 4-byte characters.
https://github.com/levelsranks/levels-ranks-core/blob/master/Game%20Server/addons/sourcemod/configs/levels_ranks/settings.ini#L124

@crashzk
Copy link
Contributor Author

crashzk commented May 1, 2021

Any way to fix this?

#57 (comment)

or enter "0" for "lr_db_allow_utf8mb4", since your database is incompatible with SourceMod MySQL Driver with 4-byte characters.
https://github.com/levelsranks/levels-ranks-core/blob/master/Game%20Server/addons/sourcemod/configs/levels_ranks/settings.ini#L124

Ok, I changed:

		// (***) Записывать ли в MySQL базу 4-ёх байтные символы (применение кодировки utf8mb4) из никнеймов игроков? [ 0 - будет использоваться utf8, 1 - да ]
		// Некоторые WEB-хостинги не предоставляют поддержку кодировки utf8mb4 для MySQL баз или имеют с ней проблемы.
		"lr_db_allow_utf8mb4" "0"
		
		// (***) Тип кодировки в таблице.
		// 0 - utf8(mb4)_general_ci .
		// 1 - utf8(mb4)_unicode_ci (Рекомендуется для MySQL 8.0+).
		"lr_db_character_type" "0"

I will be testing and returning with feedback.

@crashzk
Copy link
Contributor Author

crashzk commented May 20, 2021

Just passing to leave the feedback, even changing the cvars mentioned above, be it 0 or 1 the error still continues.

L 05/20/2021 - 15:08:36: [levelsranks.smx] SQL_Callback Error (8962): Incorrect string value: '\xF0\x9F\x9B\xB8' for column `zkservid_lvlrank`.`lvl_competitivo`.`name` at row 1

@Erik-97
Copy link

Erik-97 commented Jun 21, 2021

@crashzk any news? I has the same for months now but it barely occurs since there is not much player with special characters and emojis

@crashzk
Copy link
Contributor Author

crashzk commented Jun 21, 2021

@Erik-97 problem still occurs with me, I tried everything mentioned in this issues and others and nothing.

As said, problem is with nicks with special characters and emojis, solution I found now would be to send these players to change nicks and even force the change of nicks if necessary.

Also, if they connect with these buggy nicks, these errors still occur for them:

[LR] You account is not loaded. Please reconnect on the server!

I believe just waiting for a fix.

@Erik-97
Copy link

Erik-97 commented Aug 25, 2021

@crashzk this worked for me
"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "1"
also set all tables and name variables manually to "utf8_unicode_ci", this worked for me surprisingly

@crashzk
Copy link
Contributor Author

crashzk commented Aug 25, 2021

@crashzk this worked for me
"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "1"
also set all tables and name variables manually to "utf8_unicode_ci", this worked for me surprisingly

I will try here and return with the result.

[EDIT1]
In any case mine is configured like this:

"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "0"

In the MySQL database everything was set to utf8mb4_unicode_ci, apparently without errors too, I didn't have any more problems, at least no errors in the server logs.

@crashzk
Copy link
Contributor Author

crashzk commented Apr 1, 2022

Just to leave an updated feedback.

So far the configuration in the settings.ini file:

"lr_db_allow_utf8mb4" "0"
"lr_db_character_type" "0"

Solved my problem, no more error logs regarding it.

I believe it can be marked as resolved. In any case I will be leaving it open in case someone continues to receive an error even with this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants