1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-05 08:04:25 +03:00

Bug #25167032 CRASH WHEN ASSIGNING MY_ERRNO - MISSING MY_THREAD_INIT IN BACKGROUND THREAD

Description:
===========
Add my_thread_init() and my_thread_exit() for background threads which
initializes and frees the st_my_thread_var structure.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 15003
This commit is contained in:
Thirunarayanan Balathandayuthapani
2017-01-06 19:48:54 +05:30
committed by Marko Mäkelä
parent e180f3c5cf
commit 88a84f49b3
3 changed files with 11 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@@ -796,6 +796,7 @@ extern "C"
os_thread_ret_t os_thread_ret_t
DECLARE_THREAD(buf_dump_thread)(void*) DECLARE_THREAD(buf_dump_thread)(void*)
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
/* JAN: TODO: MySQL 5.7 PSI /* JAN: TODO: MySQL 5.7 PSI
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
@@ -836,6 +837,7 @@ DECLARE_THREAD(buf_dump_thread)(void*)
srv_buf_dump_thread_active = false; srv_buf_dump_thread_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created /* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */ thread should always use that to exit and not use return() to exit. */
os_thread_exit(); os_thread_exit();

View File

@@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2017, MariaDB Corporation.
@@ -532,6 +532,7 @@ DECLARE_THREAD(recv_writer_thread)(
/*!< in: a dummy parameter required by /*!< in: a dummy parameter required by
os_thread_create */ os_thread_create */
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
@@ -568,6 +569,7 @@ DECLARE_THREAD(recv_writer_thread)(
recv_writer_thread_active = false; recv_writer_thread_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). /* We count the number of threads in os_thread_exit().
A created thread should always use that to exit and not A created thread should always use that to exit and not
use return() to exit. */ use return() to exit. */

View File

@@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2017, MariaDB Corporation. Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
@@ -868,6 +868,8 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
/*!< in: a dummy parameter required by /*!< in: a dummy parameter required by
os_thread_create */ os_thread_create */
{ {
my_thread_init();
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD #ifdef UNIV_PFS_THREAD
@@ -878,6 +880,7 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
trx_rollback_or_clean_is_active = false; trx_rollback_or_clean_is_active = false;
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created /* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */ thread should always use that to exit and not use return() to exit. */