Skip to content

Commit 0acab3c

Browse files
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<[email protected]> RB: 15003
1 parent 69bbf9e commit 0acab3c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

storage/innobase/srv/srv0srv.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2008, 2009 Google Inc.
55
Copyright (c) 2009, Percona Inc.
66
@@ -2767,6 +2767,7 @@ srv_master_thread(
27672767
ulint i;
27682768
ib_time_t last_print_time;
27692769

2770+
my_thread_init();
27702771
#ifdef UNIV_DEBUG_THREAD_CREATION
27712772
fprintf(stderr, "Master thread starts, id %lu\n",
27722773
os_thread_pf(os_thread_get_curr_id()));
@@ -3222,6 +3223,7 @@ srv_master_thread(
32223223
os_event_wait(slot->event);
32233224

32243225
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
3226+
my_thread_end();
32253227
os_thread_exit(NULL);
32263228
}
32273229

@@ -3245,6 +3247,7 @@ srv_purge_thread(
32453247
ulint retries = 0;
32463248
ulint n_total_purged = ULINT_UNDEFINED;
32473249

3250+
my_thread_init();
32483251
ut_a(srv_n_purge_threads == 1);
32493252

32503253
#ifdef UNIV_PFS_THREAD
@@ -3329,6 +3332,8 @@ srv_purge_thread(
33293332
os_thread_pf(os_thread_get_curr_id()));
33303333
#endif /* UNIV_DEBUG_THREAD_CREATION */
33313334

3335+
my_thread_end();
3336+
33323337
/* We count the number of threads in os_thread_exit(). A created
33333338
thread should always use that to exit and not use return() to exit. */
33343339
os_thread_exit(NULL);

storage/innobase/trx/trx0roll.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
4+
Copyright (c) 2017, Oracle and/or its affiliates. All Rights Reserved.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -610,12 +611,15 @@ trx_rollback_or_clean_all_recovered(
610611
/*!< in: a dummy parameter required by
611612
os_thread_create */
612613
{
614+
my_thread_init();
615+
613616
#ifdef UNIV_PFS_THREAD
614617
pfs_register_thread(trx_rollback_clean_thread_key);
615618
#endif /* UNIV_PFS_THREAD */
616619

617620
trx_rollback_or_clean_recovered(TRUE);
618621

622+
my_thread_end();
619623
/* We count the number of threads in os_thread_exit(). A created
620624
thread should always use that to exit and not use return() to exit. */
621625

0 commit comments

Comments
 (0)