Details
-
Type:
Bug
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 10.0.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
There is an asymmetry between how
ha_initialize_handlerton and ha_finalize_handlerton
are called at start up and shutdown respectively.
ha_initialize_handlerton is called from the main()
function in mysqld, while ha_finalize_handlerton
is called from a separate thread (kill_server thread):
This is a stack trace for ha_initialize_handlerton:
#0 connect_init_func (p=0x7ffff23d5870)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/ha_connect.cc:336
#1 0x00000000007f1e73 in ha_initialize_handlerton (plugin=0x7ffff13fc608)
at /home/bar/maria-bzr/maria-10.0-connect/sql/handler.cc:497
#2 0x000000000063364a in plugin_initialize (plugin=0x7ffff13fc608)
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_plugin.cc:1343
#3 0x0000000000633e41 in plugin_init (argc=0x181a710 <remaining_argc>,
argv=0x7ffff74805c8, flags=0)
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_plugin.cc:1580
#4 0x000000000057a46e in init_server_components ()
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:4730
#5 0x000000000057b10d in mysqld_main (argc=122, argv=0x7ffff74805c8)
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:5279
#6 0x0000000000572c9c in main (argc=9, argv=0x7fffffffb638)
at /home/bar/maria-bzr/maria-10.0-connect/sql/main.cc:25
and for ha_finalilize_handlerton:
#0 connect_done_func (p=0x0)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/ha_connect.cc:388
#1 0x00000000007f1ca6 in ha_finalize_handlerton (plugin=0x7ffff13fc608)
at /home/bar/maria-bzr/maria-10.0-connect/sql/handler.cc:445
#2 0x0000000000632de9 in plugin_deinitialize (plugin=0x7ffff13fc608,
ref_check=true)
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_plugin.cc:1162
#3 0x000000000063317a in reap_plugins ()
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_plugin.cc:1236
#4 0x0000000000634b64 in plugin_shutdown ()
at /home/bar/maria-bzr/maria-10.0-connect/sql/sql_plugin.cc:1881
#5 0x0000000000575df0 in clean_up (print_message=true)
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:1988
#6 0x0000000000575bda in unireg_end ()
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:1896
#7 0x0000000000575b16 in kill_server (sig_ptr=0x0)
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:1824
#8 0x0000000000575b33 in kill_server_thread (arg=0x7ffff7d9cd48)
at /home/bar/maria-bzr/maria-10.0-connect/sql/mysqld.cc:1847
#9 0x0000000000d3a087 in pfs_spawn_thread (arg=0x7ffff0827090)
at /home/bar/maria-bzr/maria-10.0-connect/storage/perfschema/pfs.cc:1853
#10 0x00000037c7807d15 in start_thread () from /lib64/libpthread.so.0
#11 0x00000037c70f253d in clone () from /lib64/libc.so.6
This makes libxml2 (used in ConnectSE) confuse and leak some memory.
libxml2 has an internal memory pool which is bound per thread.
xmlInitParser() is called from main() and allocates some memory.
xmlCleanupParser() is not called from main() and leaks some memory.
The libxml2 manual says that xmlCleanupParser() must be called from the
main thread.
This is probably an unfortunate design in libxml2.
However, with the plugin architecture, there is a chance that
some other library can also be confused by this asymmetry
between ha_initialize_handlerton and ha_finalize_handlerton.
It would be nice to move the call for ha_finalize_handlerton
from kill_thread to main().
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions