[MDEV-24071] embedded server crashes when mysql_library_init called after mysql_library_end Created: 2020-10-30 Updated: 2023-04-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Embedded Server |
| Affects Version/s: | 10.4.15 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Erica Mann (Inactive) | Assignee: | Marko Mäkelä |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
ubuntu 20.04 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
simply running mysql_library_init() ... mysql_library_end() works as expected. However, if mysql_library_init() is later called to reinitialize the library, it crashes with a signal 11. I have attached a simple test which reproduces the problem. I do have a core as well (too large to attach here) build flags were cmake -DCMAKE_INSTALL_PREFIX=$HOME/mytile_server -DWITH_EMBEDDED_SERVER=ON -DPLUGIN_TOKUDB=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_SPHINX=NO -DPLUGIN_FEDERATED=NO -DPLUGIN_FEDERATEDX=NO -DPLUGIN_CONNECT=NO -DCMAKE_BUILD_TYPE=Debug -SWITH_DEBUG=1 .. |
| Comments |
| Comment by Vladislav Vaintroub [ 2022-07-05 ] | |||||||||||||||
|
General thoughts - it might not be easily doable, and perhaps we should not be fixing it (for one, it probably never worked, and the effort might be too high for "embedded server" component which hade been practically unmaintained for decade(s)). The reason for failing reinit is that there is quite a lot of static data inside the server, which is changed during server initialization, and this static data is not reset when the server is shut down. There is not reason usually to reset the static data if the server is running in normal mode , as a process. As a workaround, if someone manages to dynamically load and unload the embedded library, I guess the static data will be all reset, so it could be a workaround. With that, I fixed a crash and an assertion in the server, so now it crashes/asserts in innodb, thus marko will be a new proud owner of this bug to reproduce, clone 10.6-MDEV-24071, compile with embedded/debug, and execute embtest, located in libmysqld/examples (or libmysqld\examples\Debug on Windows) . For me , it asserts with this callstack
The assertion is table->magic_n is 0x00007ff72cec36a0 |