Commit c05bc3bb authored by Kentoku SHIBA's avatar Kentoku SHIBA

fix illegal memory access for background sts/crd for windows

parent 2c84f563
......@@ -2128,6 +2128,9 @@ void *spider_bg_conn_action(
if (!(trx = spider_get_trx(thd, FALSE, &error_num)))
{
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
pthread_cond_signal(&conn->bg_conn_sync_cond);
pthread_mutex_unlock(&conn->bg_conn_sync_mutex);
......@@ -2184,6 +2187,9 @@ void *spider_bg_conn_action(
spider_free_trx(trx, TRUE);
/* lex_end(thd->lex); */
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
pthread_cond_signal(&conn->bg_conn_sync_cond);
pthread_mutex_unlock(&conn->bg_conn_mutex);
......@@ -2637,7 +2643,7 @@ void *spider_bg_sts_action(
pthread_mutex_unlock(&share->sts_mutex);
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -2652,6 +2658,9 @@ void *spider_bg_sts_action(
if (!(trx = spider_get_trx(thd, FALSE, &error_num)))
{
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
share->bg_sts_thd_wait = FALSE;
share->bg_sts_kill = FALSE;
share->bg_sts_init = FALSE;
......@@ -2661,7 +2670,7 @@ void *spider_bg_sts_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -2717,6 +2726,9 @@ void *spider_bg_sts_action(
}
spider_free_trx(trx, TRUE);
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
share->bg_sts_thd_wait = FALSE;
share->bg_sts_kill = FALSE;
share->bg_sts_init = FALSE;
......@@ -2726,7 +2738,7 @@ void *spider_bg_sts_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -2750,6 +2762,9 @@ void *spider_bg_sts_action(
}
spider_free_trx(trx, TRUE);
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
pthread_cond_signal(&share->bg_sts_sync_cond);
pthread_mutex_unlock(&share->sts_mutex);
#if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32)
......@@ -2757,7 +2772,7 @@ void *spider_bg_sts_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -3006,7 +3021,7 @@ void *spider_bg_crd_action(
pthread_mutex_unlock(&share->crd_mutex);
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -3021,6 +3036,9 @@ void *spider_bg_crd_action(
if (!(trx = spider_get_trx(thd, FALSE, &error_num)))
{
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
share->bg_crd_thd_wait = FALSE;
share->bg_crd_kill = FALSE;
share->bg_crd_init = FALSE;
......@@ -3030,7 +3048,7 @@ void *spider_bg_crd_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -3090,6 +3108,9 @@ void *spider_bg_crd_action(
}
spider_free_trx(trx, TRUE);
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
share->bg_crd_thd_wait = FALSE;
share->bg_crd_kill = FALSE;
share->bg_crd_init = FALSE;
......@@ -3099,7 +3120,7 @@ void *spider_bg_crd_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -3123,6 +3144,9 @@ void *spider_bg_crd_action(
}
spider_free_trx(trx, TRUE);
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
pthread_cond_signal(&share->bg_crd_sync_cond);
pthread_mutex_unlock(&share->crd_mutex);
#if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32)
......@@ -3130,7 +3154,7 @@ void *spider_bg_crd_action(
#endif
my_thread_end();
#ifdef _MSC_VER
spider_free(spider_current_trx, need_mons, MYF(MY_WME));
spider_free(NULL, need_mons, MYF(MY_WME));
#endif
DBUG_RETURN(NULL);
}
......@@ -3460,6 +3484,9 @@ void *spider_bg_mon_action(
if (!(trx = spider_get_trx(thd, FALSE, &error_num)))
{
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
share->bg_mon_kill = FALSE;
share->bg_mon_init = FALSE;
pthread_cond_signal(&share->bg_mon_conds[link_idx]);
......@@ -3490,6 +3517,9 @@ void *spider_bg_mon_action(
pthread_mutex_unlock(&share->bg_mon_mutexes[link_idx]);
spider_free_trx(trx, TRUE);
delete thd;
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
set_current_thd(NULL);
#endif
#if !defined(MYSQL_DYNAMIC_PLUGIN) || !defined(_WIN32)
my_pthread_setspecific_ptr(THR_THD, NULL);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment