Commit ec5b0f37 authored by unknown's avatar unknown

Merge mysql.com:/opt/local/work/mysql-5.0-root

into  mysql.com:/opt/local/work/mysql-5.0-runtime-merge
parents e8a8de88 8ce654d1
...@@ -788,7 +788,8 @@ static void die(const char* fmt, ...) ...@@ -788,7 +788,8 @@ static void die(const char* fmt, ...)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(args); va_end(args);
cleanup(); cleanup();
my_end(0); /* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(MY_DONT_FREE_DBUG);
exit(1); exit(1);
} }
...@@ -1460,7 +1461,8 @@ int main(int argc, char** argv) ...@@ -1460,7 +1461,8 @@ int main(int argc, char** argv)
cleanup(); cleanup();
free_defaults(defaults_argv); free_defaults(defaults_argv);
my_free_open_file_info(); my_free_open_file_info();
my_end(0); /* We cannot free DBUG, it is used in global destructors after exit(). */
my_end(MY_DONT_FREE_DBUG);
exit(exit_value); exit(exit_value);
DBUG_RETURN(exit_value); // Keep compilers happy DBUG_RETURN(exit_value); // Keep compilers happy
} }
......
...@@ -271,6 +271,8 @@ static unsigned long Clock (void); ...@@ -271,6 +271,8 @@ static unsigned long Clock (void);
static void CloseFile(FILE *fp); static void CloseFile(FILE *fp);
/* Push current debug state */ /* Push current debug state */
static void PushState(void); static void PushState(void);
/* Free memory associated with debug state. */
static void FreeState (struct state *state);
/* Test for tracing enabled */ /* Test for tracing enabled */
static BOOLEAN DoTrace(CODE_STATE *state); static BOOLEAN DoTrace(CODE_STATE *state);
/* Test to see if file is writable */ /* Test to see if file is writable */
...@@ -630,22 +632,7 @@ void _db_pop_ () ...@@ -630,22 +632,7 @@ void _db_pop_ ()
stack = discard -> next_state; stack = discard -> next_state;
_db_fp_ = stack -> out_file; _db_fp_ = stack -> out_file;
_db_pfp_ = stack -> prof_file; _db_pfp_ = stack -> prof_file;
if (discard -> keywords != NULL) { FreeState(discard);
FreeList (discard -> keywords);
}
if (discard -> functions != NULL) {
FreeList (discard -> functions);
}
if (discard -> processes != NULL) {
FreeList (discard -> processes);
}
if (discard -> p_functions != NULL) {
FreeList (discard -> p_functions);
}
CloseFile (discard -> out_file);
if (discard -> prof_file)
CloseFile (discard -> prof_file);
free ((char *) discard);
if (!(stack->flags & DEBUG_ON)) if (!(stack->flags & DEBUG_ON))
_db_on_=0; _db_on_=0;
} }
...@@ -1160,6 +1147,71 @@ static void PushState () ...@@ -1160,6 +1147,71 @@ static void PushState ()
stack=new_malloc; stack=new_malloc;
} }
/*
* FUNCTION
*
* FreeState Free memory associated with a struct state.
*
* SYNOPSIS
*
* static void FreeState (state)
* struct state *state;
*
* DESCRIPTION
*
* Deallocates the memory allocated for various information in a
* state.
*
*/
static void FreeState (
struct state *state)
{
if (state -> keywords != NULL) {
FreeList (state -> keywords);
}
if (state -> functions != NULL) {
FreeList (state -> functions);
}
if (state -> processes != NULL) {
FreeList (state -> processes);
}
if (state -> p_functions != NULL) {
FreeList (state -> p_functions);
}
CloseFile (state -> out_file);
if (state -> prof_file)
CloseFile (state -> prof_file);
free ((char *) state);
}
/*
* FUNCTION
*
* _db_end_ End debugging, freeing state stack memory.
*
* SYNOPSIS
*
* static VOID _db_end_ ()
*
* DESCRIPTION
*
* Ends debugging, de-allocating the memory allocated to the
* state stack.
*
* To be called at the very end of the program.
*
*/
void _db_end_ ()
{
reg1 struct state *discard;
while((discard= stack) != NULL) {
stack= discard -> next_state;
FreeState (discard);
}
_db_on_=0;
}
/* /*
* FUNCTION * FUNCTION
......
...@@ -40,6 +40,7 @@ extern void _db_doprnt_ _VARARGS((const char *format,...)); ...@@ -40,6 +40,7 @@ extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory, extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length); uint length);
extern void _db_output_(uint flag); extern void _db_output_(uint flag);
extern void _db_end_(void);
extern void _db_lock_file(void); extern void _db_lock_file(void);
extern void _db_unlock_file(void); extern void _db_unlock_file(void);
...@@ -66,6 +67,7 @@ extern void _db_unlock_file(void); ...@@ -66,6 +67,7 @@ extern void _db_unlock_file(void);
#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr) #define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
#define DEBUGGER_OFF _no_db_=1;_db_on_=0; #define DEBUGGER_OFF _no_db_=1;_db_on_=0;
#define DEBUGGER_ON _no_db_=0 #define DEBUGGER_ON _no_db_=0
#define DBUG_END() _db_end_ ()
#define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_OUTPUT(A) { _db_output_(A); }
...@@ -90,6 +92,7 @@ extern void _db_unlock_file(void); ...@@ -90,6 +92,7 @@ extern void _db_unlock_file(void);
#define DBUG_IN_USE 0 #define DBUG_IN_USE 0
#define DEBUGGER_OFF #define DEBUGGER_OFF
#define DEBUGGER_ON #define DEBUGGER_ON
#define DBUG_END()
#define DBUG_LOCK_FILE #define DBUG_LOCK_FILE
#define DBUG_UNLOCK_FILE #define DBUG_UNLOCK_FILE
#define DBUG_OUTPUT(A) #define DBUG_OUTPUT(A)
......
...@@ -75,6 +75,7 @@ extern int NEAR my_errno; /* Last error in mysys */ ...@@ -75,6 +75,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_GIVE_INFO 2 /* Give time info about process*/
#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
#define ME_HIGHBYTE 8 /* Shift for colours */ #define ME_HIGHBYTE 8 /* Shift for colours */
#define ME_NOCUR 1 /* Don't use curses message */ #define ME_NOCUR 1 /* Don't use curses message */
......
...@@ -178,7 +178,7 @@ void STDCALL mysql_server_end() ...@@ -178,7 +178,7 @@ void STDCALL mysql_server_end()
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
{ {
my_end(0); my_end(MY_DONT_FREE_DBUG);
#ifndef THREAD #ifndef THREAD
/* Remove TRACING, if enabled by mysql_debug() */ /* Remove TRACING, if enabled by mysql_debug() */
DBUG_POP(); DBUG_POP();
......
...@@ -190,8 +190,4 @@ select HEX(f) from t4; ...@@ -190,8 +190,4 @@ select HEX(f) from t4;
HEX(f) HEX(f)
835C 835C
flush logs; flush logs;
select * from t5 /* must be (1),(1) */; drop table t1, t2, t03, t04, t3, t4;
a
1
1
drop table t1, t2, t03, t04, t3, t4, t5;
...@@ -103,15 +103,24 @@ f ...@@ -103,15 +103,24 @@ f
1 1
drop temporary table t4; drop temporary table t4;
drop table t5; drop table t5;
set @session.pseudo_thread_id=100; set @@session.pseudo_thread_id=100;
create temporary table t101 (id int); create temporary table t101 (id int);
create temporary table t102 (id int); create temporary table t102 (id int);
set @session.pseudo_thread_id=200; set @@session.pseudo_thread_id=200;
create temporary table t201 (id int); create temporary table t201 (id int);
create temporary table `#not_user_table_prefixed_with_hash_sign_no_harm` (id int); create temporary table `t``201` (id int);
create temporary table `#sql_not_user_table202` (id int);
set @@session.pseudo_thread_id=300;
create temporary table t301 (id int);
create temporary table t302 (id int);
create temporary table `#sql_not_user_table303` (id int);
create table t1(f int); create table t1(f int);
insert into t1 values (1); insert into t1 values (1);
select * from t1 /* must be 1 */; select * from t1 /* must be 1 */;
f f
1 1
drop table t1; drop table t1;
select * from t1;
a
1
drop table t1;
...@@ -123,16 +123,21 @@ select HEX(f) from t04; ...@@ -123,16 +123,21 @@ select HEX(f) from t04;
select HEX(f) from t4; select HEX(f) from t4;
# #
#14157: utf8 encoding in binlog without set character_set_client # BUG#14157: utf8 encoding in binlog without set character_set_client
#
# BUG:
# This test only works on the MySQL-internal rpl machines.
# Needs to be fixed. Problem is that koi8r is not installed
# on many machines.
# #
flush logs; flush logs;
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=koi8r test -e 'create table if not exists t5 (a int); set names koi8r; create temporary table `` (a int); insert into `` values (1); insert into t5 select * from ``' # --exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=koi8r test -e 'create table if not exists t5 (a int); set names koi8r; create temporary table `` (a int); insert into `` values (1); insert into t5 select * from ``'
# resulted log is client charset insensitive (latin1 not koi8r) as it must be # resulted log is client charset insensitive (latin1 not koi8r) as it must be
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 | $MYSQL --default-character-set=latin1 # --exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 | $MYSQL --default-character-set=latin1
select * from t5 /* must be (1),(1) */; #select * from t5 /* must be (1),(1) */;
# clean up # clean up
drop table t1, t2, t03, t04, t3, t4, t5; drop table t1, t2, t03, t04, t3, t4;
# End of 5.0 tests # End of 5.0 tests
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
fun:calloc fun:calloc
fun:_dl_allocate_tls fun:_dl_allocate_tls
fun:allocate_stack fun:allocate_stack
fun:pthread_create@@GLIBC_2.1 fun:pthread_create*
} }
{ {
...@@ -33,15 +33,6 @@ ...@@ -33,15 +33,6 @@
fun:pthread_create* fun:pthread_create*
} }
{
pthread allocate_dtv memory loss second
Memcheck:Leak
fun:calloc
fun:allocate_dtv
fun:_dl_allocate_tls
fun:pthread_create*
}
{ {
pthread memalign memory loss pthread memalign memory loss
Memcheck:Leak Memcheck:Leak
...@@ -72,17 +63,6 @@ ...@@ -72,17 +63,6 @@
obj:/lib/ld-*.so obj:/lib/ld-*.so
} }
{
pthread strstr uninit
Memcheck:Cond
fun:strstr
obj:/lib/tls/libpthread.so.*
obj:/lib/tls/libpthread.so.*
fun:call_init
fun:_dl_init
obj:/lib/ld-*.so
}
{ {
pthread errno pthread errno
Memcheck:Leak Memcheck:Leak
...@@ -152,3 +132,163 @@ ...@@ -152,3 +132,163 @@
obj:*/libz.so.* obj:*/libz.so.*
fun:gzflush fun:gzflush
} }
#
# Leaks reported in _dl_* internal functions on Linux amd64 / glibc2.3.2.
#
{
_dl_start invalid write8
Memcheck:Addr8
fun:_dl_start
}
{
_dl_start invalid write4
Memcheck:Addr4
fun:_dl_start
}
{
_dl_start/_dl_setup_hash invalid read8
Memcheck:Addr8
fun:_dl_setup_hash
fun:_dl_start
}
{
_dl_sysdep_start invalid write8
Memcheck:Addr8
fun:_dl_sysdep_start
}
{
_dl_init invalid write8
Memcheck:Addr8
fun:_dl_init
}
{
_dl_init invalid write4
Memcheck:Addr4
fun:_dl_init
}
{
_dl_init/_dl_init invalid read8
Memcheck:Addr8
fun:_dl_debug_initialize
fun:_dl_init
}
{
_dl_init/_dl_debug_state invalid read8
Memcheck:Addr8
fun:_dl_debug_state
fun:_dl_init
}
{
init invalid write8
Memcheck:Addr8
fun:init
}
{
fixup invalid write8
Memcheck:Addr8
fun:fixup
}
{
fixup/_dl_lookup_versioned_symbol invalid read8
Memcheck:Addr8
fun:_dl_lookup_versioned_symbol
fun:fixup
}
{
_dl_runtime_resolve invalid read8
Memcheck:Addr8
fun:_dl_runtime_resolve
}
{
__libc_start_main invalid write8
Memcheck:Addr8
fun:__libc_start_main
}
{
__libc_start_main/__sigjmp_save invalid write4
Memcheck:Addr4
fun:__sigjmp_save
fun:__libc_start_main
}
#
# These seem to be libc threading stuff, not related to MySQL code (allocations
# during pthread_exit()). Googling shows other projects also using these
# suppressions.
#
# Note that these all stem from pthread_exit() deeper in the call stack, but
# Valgrind only allows the top four calls in the suppressions.
#
{
libc pthread_exit 1
Memcheck:Leak
fun:malloc
fun:_dl_new_object
fun:_dl_map_object_from_fd
fun:_dl_map_object
}
{
libc pthread_exit 2
Memcheck:Leak
fun:malloc
fun:_dl_map_object
fun:dl_open_worker
fun:_dl_catch_error
}
{
libc pthread_exit 3
Memcheck:Leak
fun:malloc
fun:_dl_map_object_deps
fun:dl_open_worker
fun:_dl_catch_error
}
{
libc pthread_exit 4
Memcheck:Leak
fun:calloc
fun:_dl_check_map_versions
fun:dl_open_worker
fun:_dl_catch_error
}
{
libc pthread_exit 5
Memcheck:Leak
fun:calloc
fun:_dl_new_object
fun:_dl_map_object_from_fd
fun:_dl_map_object
}
#
# This is seen internally in the system libraries on 64-bit RHAS3.
#
{
__lll_mutex_unlock_wake uninitialized
Memcheck:Param
futex(utime)
fun:__lll_mutex_unlock_wake
}
...@@ -196,8 +196,10 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", ...@@ -196,8 +196,10 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
_CrtDumpMemoryLeaks(); _CrtDumpMemoryLeaks();
#endif #endif
} }
if (!(infoflag & MY_DONT_FREE_DBUG))
DBUG_END(); /* Must be done before my_thread_end */
#ifdef THREAD #ifdef THREAD
DBUG_POP(); /* Must be done before my_thread_end */
my_thread_end(); my_thread_end();
my_thread_global_end(); my_thread_global_end();
#if defined(SAFE_MUTEX) #if defined(SAFE_MUTEX)
......
...@@ -986,6 +986,10 @@ static void __cdecl kill_server(int sig_ptr) ...@@ -986,6 +986,10 @@ static void __cdecl kill_server(int sig_ptr)
pthread_join(select_thread, NULL); // wait for main thread pthread_join(select_thread, NULL); // wait for main thread
#endif /* __NETWARE__ */ #endif /* __NETWARE__ */
#if defined(__NETWARE__) || (defined(USE_ONE_SIGNAL_HAND) && !defined(__WIN__) && !defined(OS2))
my_thread_end();
#endif
pthread_exit(0); /* purecov: deadcode */ pthread_exit(0); /* purecov: deadcode */
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
......
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