Hi,Sergei !
Thanks for the reply and your help.
I'll tell you my problem in detail.
As I mentioned my last letter, I'm develping mariadb monitoring tool as a daemon plugin type.
Source version is 10.1.3-MariaDB-wsrep-debug-log.
When I run install plugin command, server crashed.
So for test, I removed comment line by line.
Here is source.
--------- source ------------------------------------------------------------
pthread_handler_t monm_monitor(void *p)
{
DBUG_ENTER("monm_plugin_test");
...
THD* thd;
thd = new THD; --> at this point, error occurred.
//thd->thread_stack= (char*) &thd;
//thd->store_globals();
//tables.init_one_table("performance_schema", 18, "events_statements_current", 25, "events_statements_current", TL_READ);
//open_and_lock_tables(thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
while(1)
{
...
}
}
---------------------------------------------------------------------------------
At that time, error messag is below,
---------------------------------------------------------------------------------
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x0):
Connection ID (thread ID): 0
Status: NOT_KILLED
Here is gdb bt result.
---------------------------------------------------------------------------------
#0 0x000000385cc0c8ac in pthread_kill () from /lib64/libpthread.so.0
#1 0x0000000000c4a270 in my_write_core (sig=11) at /home/windfree/workspace/ws-mariadb/maria-mon/mysys/stacktrace.c:457
#2 0x0000000000754053 in handle_fatal_signal (sig=11) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/signal_handler.cc:266
#3 <signal handler called>
#4 my_thread_name () at /home/windfree/workspace/ws-mariadb/maria-mon/mysys/my_thr_init.c:416
#5 0x0000000000c56574 in wt_thd_lazy_init (thd=0x7fc3a8003a90, ds=0x7fc3a80012e8, ts=0x7fc3a80012e0, dl=0x7fc3a80012f8, tl=0x7fc3a80012f0)
at /home/windfree/workspace/ws-mariadb/maria-mon/mysys/waiting_threads.c:511
#6 0x0000000000598752 in THD::THD (this=0x7fc3a8000930, is_wsrep_applier=false) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_class.cc:1015
#7 0x00007fc3f7851205 in monm_monitor (p=<value optimized out>) at /home/windfree/workspace/ws-mariadb/maria-mon/plugin/monm/monm_plugin_info.cc:70
#8 0x000000385cc079d1 in start_thread () from /lib64/libpthread.so.0
#9 0x000000385c4e88fd in clone () from /lib64/libc.so.6
------------------------------------------------------------------------------------------------------------
In addition, I moved that source line to init function as below.
And for test, I removed comment line by line.
At this time, An error occurred at another line.
When I removed comment of source line (thd->store_globals()) and run install plugin command, server crashed .
----- source ----------------------------------------------------------------------
static int monm_plugin_init(void *p __attribute__ ((unused)))
{
...
thd = new THD;
thd->thread_stack= (char*) &thd;
thd->store_globals(); // --> at this point, error occurred
//tables.init_one_table("performance_schema", 18, "events_statements_current", 25, "events_statements_current", TL_READ);
//open_and_lock_tables(thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
...
...
}
---------------------------------------------------------------------------------
At that time, error messag is below,
---------------------------------------------------------------------------------
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x0):
Connection ID (thread ID): 0
Status: NOT_KILLED
Here is gdb bt result.
---------------------------------------------------------------------------------
#0 0x000000385cc0c8ac in pthread_kill () from /lib64/libpthread.so.0
#1 0x0000000000c4a270 in my_write_core (sig=6) at /home/windfree/workspace/ws-mariadb/maria-mon/mysys/stacktrace.c:457
#2 0x0000000000754053 in handle_fatal_signal (sig=6) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/signal_handler.cc:266
#3 <signal handler called>
#4 0x000000385c432625 in raise () from /lib64/libc.so.6
#5 0x000000385c433e05 in abort () from /lib64/libc.so.6
#6 0x000000385c42b74e in __assert_fail_base () from /lib64/libc.so.6
#7 0x000000385c42b810 in __assert_fail () from /lib64/libc.so.6
#8 0x00000000007584a2 in handler::ha_thd (this=0x7f91e4023f18) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/handler.cc:2453
#9 0x000000000075eaf7 in mark_trx_read_write (this=0x7f91e4023f18, buf=0x7f91e4014cf8 "\004monm")
at /home/windfree/workspace/ws-mariadb/maria-mon/sql/handler.cc:3929
#10 handler::ha_write_row (this=0x7f91e4023f18, buf=0x7f91e4014cf8 "\004monm") at /home/windfree/workspace/ws-mariadb/maria-mon/sql/handler.cc:5852
#11 0x00000000005d53b0 in finalize_install (thd=0x47ecad0, table=0x7f91e40140d0, name=0x47f12f0, argc=0x7f923c3dcc3c, argv=<value optimized out>)
at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_plugin.cc:2077
#12 0x00000000005d76ba in mysql_install_plugin (thd=0x47ecad0, name=0x47f12f0, dl_arg=<value optimized out>)
at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_plugin.cc:2151
#13 0x00000000005cb430 in mysql_execute_command (thd=0x47ecad0) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_parse.cc:5445
#14 0x00000000005cb614 in mysql_parse (thd=0x47ecad0, rawbuf=0x7f91e40033c8 "install plugin monm soname 'libmonm.so'", length=<value optimized out>,
parser_state=0x7f923c3de740) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_parse.cc:7141
#15 0x00000000005ccb1a in dispatch_command (command=COM_QUERY, thd=0x47ecad0, packet=<value optimized out>, packet_length=39)
at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_parse.cc:1462
#16 0x00000000005ceaeb in do_command (thd=0x47ecad0) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_parse.cc:1092
#17 0x000000000069c8d7 in do_handle_one_connection (thd_arg=<value optimized out>) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_connect.cc:1347
#18 0x000000000069cab3 in handle_one_connection (arg=0x47ecad0) at /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_connect.cc:1258
#19 0x0000000000c0b44a in pfs_spawn_thread (arg=0x47f6900) at /home/windfree/workspace/ws-mariadb/maria-mon/storage/perfschema/pfs.cc:1860
#20 0x000000385cc079d1 in start_thread () from /lib64/libpthread.so.0
#21 0x000000385c4e88fd in clone () from /lib64/libc.so.6
----------------------------------------------------------------------------------------
I don't know the reason of this error.
Regards,
Kyungnam.
Hi, 김경남!
On Mar 26, 김경남 wrote:
> Hi, Sergei!
>
> I'm writing daemon plugin . I hava a problem and don't find soultion
> yet.
>
> In monm_monitor function,
>
> THD* thd cause server crash. so I examined coredump.
>
> #6 0x0000000000598752 in THD::THD (this=0x7f9b64000930, is_wsrep_applier=false) at
> /home/windfree/workspace/ws-mariadb/maria-mon/sql/sql_class.cc:1015
>
> I don't know the reason of crash.
Neither do I. What MariaDB version do you use? 10.1.2? 10.1.3?
I don't see how it could've crashed on that line.
Please, show the complete stack trace ('bt' command) and lines around
sql_class.cc:1015.
Regards,
Sergei