[MDEV-26325] mysqld process hangs when stopped after executing mysql_upgrade Created: 2021-08-09 Updated: 2021-11-29 Resolved: 2021-08-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.5.12 |
| Fix Version/s: | 10.5.13, 10.6.5 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Anton Serbulov | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | hang | ||
| Environment: |
Windows |
||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
Steps to reproduce
Actual result
|
| Comments |
| Comment by Elena Stepanova [ 2021-08-09 ] | |||||||||||||||||
|
Would you be able to take a minidump from the hanging server? | |||||||||||||||||
| Comment by Anton Serbulov [ 2021-08-09 ] | |||||||||||||||||
|
The full memory dump of the mysqld process: ftp://ftp.mariadb.org/private/mysqld.exe_210809_182646.dmp.zip | |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-08-09 ] | |||||||||||||||||
|
I can reproduce That's how it hangs
That's where it hangs in close_connections()
CONNECT::count is 0xfffffff3 | |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-08-09 ] | |||||||||||||||||
|
serg, this is As consequence it breaks mysql_upgrade_service, which works somewhat like the reporter described. The reason for the bug is that there is a constructor for CONNECT that does not increment CONNECT::count, but destructor always decrements it. below would fix it, but I let you decide whether there is a more elegant workaround,
| |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-08-09 ] | |||||||||||||||||
|
To reproduce it more easily start mysqld with
and from another cmd window
The server won't shutdown
is an indicator that pipe should be used
would do the same | |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-08-10 ] | |||||||||||||||||
|
serg, what do you think of https://github.com/MariaDB/server/commit/236e7e964b79377717ac1237965f2d4bd51b5b36 I restored the idea of the generic templated object counter, so that we do not have THD_count and CONNECT_count classes | |||||||||||||||||
| Comment by Sergei Golubchik [ 2021-08-12 ] | |||||||||||||||||
|
I'd prefer just one more count++ as you had in your comment above. Template is kind of nice, but rather artificial, because it doesn't use the type T for anything. I'm not even sure it's guaranteed to work, given that the template doesn't depend on the type, what prevents a sufficiently smart compiler to "optimize" it into only one instance of the class? | |||||||||||||||||
| Comment by Vladislav Vaintroub [ 2021-08-12 ] | |||||||||||||||||
|
I'm not sure it is guaranteed to work either, but a similar example is in Wikipedia, so it is more trustable than I would come up with that myself , and compiler writers maybe would not like to break that use of "curiously recurring template pattern" https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern#Object_counter Also, this is used in Scott Meyers' article from back 1998 about how to count objects in C++ ,and he perhaps can be trusted. Thinking a little more, I'd guess templates with different template parameters can't legally be merged into the same object. Anyway, Scott Meyers, Wikipedia , and stackoverflow may be enough evidence. |