1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-28561 Assertion failed: !pfs->m_idle || (state == PSI_SOCKET_STATE_ACTIVE)

The error was specific to threadpool/compressed protocol.
set_thd_idle() set socket state to idle twice, causing assert failure.

This happens if unread compressed data on connection,after query was
finished. On a protocol level, this means a single compression packet
contains multiple command packets.
This commit is contained in:
Vladislav Vaintroub
2023-09-27 17:57:24 +02:00
parent 3c65434b78
commit 87d1ab9ad9
2 changed files with 31 additions and 6 deletions

View File

@ -124,12 +124,17 @@ static void re_init_net_server_extension(THD *thd)
#endif /* HAVE_PSI_INTERFACE */
static inline bool has_unread_compressed_data(const NET *net)
{
return net->compress && net->remain_in_buf;
}
static inline void set_thd_idle(THD *thd)
{
thd->net.reading_or_writing= 1;
#ifdef HAVE_PSI_INTERFACE
net_before_header_psi(&thd->net, thd, 0);
if (!has_unread_compressed_data(&thd->net))
net_before_header_psi(&thd->net, thd, 0);
#endif
}
@ -326,10 +331,8 @@ static void handle_wait_timeout(THD *thd)
static bool has_unread_data(THD* thd)
{
NET *net= &thd->net;
if (net->compress && net->remain_in_buf)
return true;
Vio *vio= net->vio;
return vio->has_data(vio);
return vio->has_data(vio) || has_unread_compressed_data(net);
}