[MXS-1804] request 16M-1 stmt_prepare command packet connect hang Created: 2018-04-16  Updated: 2018-07-17  Resolved: 2018-05-03

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: 2.2
Fix Version/s: 2.2.5, 2.3.0

Type: Bug Priority: Major
Reporter: xiangzhong Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Sprint: MXS-SPRINT-57

 Description   

exec stmt_prepare command(command id 0x16) select 'fff..'; this packet size 16M-1, not include header; now the connect hang.

pseudo code:
input : sqlsize = 16777215

int sql_str_size(unsigned int sqlsize)
{
    char prefx[] = "select ''";
    return sqlsize -  strlen(prefx) - 1;
}
 
void gen_select_sqlstr(char *sqlstr, unsigned int strsize, int sqlsize)
{
    strcpy(sqlstr, "select '");
    memset(sqlstr+strlen("select '"), 'f', strsize);
    sqlstr[sqlsize-2] = '\'';
    sqlstr[sqlsize-1] = '\0';
}
 
void test()
{
    strsize = sql_str_size(sqlsize);
 
    sqlstr = (char *)malloc(sqlsize);
    gen_select_sqlstr(sqlstr, strsize, sqlsize);
 
   if (mysql_stmt_prepare(stmt, sqlstr, strlen(sqlstr)) != 0) // where strlen(sqlstr) == 16777215
}



 Comments   
Comment by xiangzhong [ 2018-04-16 ]

code :if (mysql_stmt_prepare(stmt, sql, strlen(sql)) != 0) // where strlen(sql) == 16777215

Comment by markus makela [ 2018-04-17 ]

Reproduced it.

Comment by markus makela [ 2018-04-17 ]

This appears to be caused by a limitation in the current implementation of the router. If a command that does not fit into one packet is supposed to be routed to all servers, the router will hang.

Comment by markus makela [ 2018-05-03 ]

Due to the amount of changes required, this is fixed only in 2.3. In practice, this bug is nigh impossible to hit with normal usage.

Generated at Thu Feb 08 04:09:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.