Bug #109376 | mysqlx_execute freeze on wrong input json format | ||
---|---|---|---|
Submitted: | 14 Dec 2022 13:24 | Modified: | 4 Jul 2024 12:28 |
Reporter: | Ukrid Pawaktanon | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / C++ | Severity: | S2 (Serious) |
Version: | 8.0.31 | OS: | Ubuntu (22.04) |
Assigned to: | MySQL Verification Team | CPU Architecture: | x86 |
[14 Dec 2022 13:24]
Ukrid Pawaktanon
[14 Dec 2022 14:22]
MySQL Verification Team
Hi Mr. Pawaktanon, Thank you for your bug report. However, we need also the table involved in this query and it's contents. It seems that a negative offset in json_body->>'$.index_ triggers a problem, but we have to be able to reproduce it.
[14 Dec 2022 15:51]
Ukrid Pawaktanon
//table CREATE TABLE `invoice_db` ( `id` int NOT NULL, `json_body` json NOT NULL, `status` tinyint NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; //json_body {"state": "normal","invoice_date": "2022-12-13"}
[14 Dec 2022 15:57]
Ukrid Pawaktanon
mysqlx_stmt_t *crud_stmt = mysqlx_sql_new(mysql_session,"Select JSON_EXTRACT(json_body,'invoice_date') FROM invoice_db",MYSQLX_NULL_TERMINATED); // create stmt if ( crud_stmt ) { //freeze here mysqlx_result_t *mysql_result = mysqlx_execute(crud_stmt); }
[15 Dec 2022 13:05]
MySQL Verification Team
Hi Mr. Pawaktanon, Thank you for providing some of the test case. However, we need full test case. We need contents of the data and the entire source program that you use and that will lead to the error. Can you try executing the same commands from MySQL CLI or MySQL Shell ????? Waiting on your feedback.
[15 Dec 2022 17:14]
Ukrid Pawaktanon
Hi MySQL Verification Team, Thank you for your prompt reply. Sorry for my bad English. Yes I already tried the same sql query on MySQL-Shell ,it worked properly With my invalid JSON path query I got ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 1. I expected the same thing on mysqlx_execute function ,but it freezed ,I writed this code on C++ Thread ,when it got freezed ,it never leave from the Thread.
[15 Dec 2022 17:27]
Ukrid Pawaktanon
mysqlx_error_t *error_get_session=nullptr; mysqlx_client_t *mysql_session = mysqlx_get_client_from_url( GetMySqlClientConStringUrl(m_db_con_param_struct) , "{\"pooling\": {\"enabled\": true,\"maxSize\": 100,\"queueTimeout\": 5000,\"maxIdleTime\": 5000}}" , &error_get_session ); if ( error_get_session ) { std::string error_msg=std::string{ mysqlx_error_message(error_get_session) }; mysqlx_free(error_get_session); return error_msg; } if ( mysql_session ) { //try invalid json-path with invoice_date ,the correct is $.invoice_date const std::string prepare_sql_str="Select JSON_EXTRACT(json_body,'invoice_date')"; mysqlx_stmt_t *mysql_crud_stmt = mysqlx_sql_new(mysql_session, e_prepare_sql_str.c_str() ,MYSQLX_NULL_TERMINATED); // create stmt if ( mysql_crud_stmt ) { //***freeze here mysqlx_result_t *mysql_result = mysqlx_execute(mysql_crud_stmt); } }
[4 Jun 2024 12:28]
MySQL Verification Team
Hello Ukrid Pawaktanon, Thank you for the details. Please upgrade to latest version and report us back if issue persist even in latest version along with test case. Thank you. Regards, Ashwini Patil
[5 Jul 2024 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".