Re: [PATCH] Sid_map::Sid_map calls DBUG which may have unitialized THR_KEY_mysys and thus crash
Davi Arnaut <[email protected]> Thu, 19 Jul 2012 08:04:15 -0700
| Newsgroups | gmane.comp.db.mysql.devel |
|---|---|
| Message-ID | <CAJJDKOvnuHG1MZ4Jr7B-Kd7K_DLERXqX9_r6+r5tPyWy2Fz0NQ@mail.gmail.com> |
On Wed, Jul 18, 2012 at 9:59 PM, Stewart Smith <[email protected]> wrote: > IF you are really lucky (or unlucky), the order in which things are > initialized on server startup goes a bit diferent than you'd expect. I > managed to get this to reproduce by always LD_PRELOADING > libeatmydata. This may also occur if LD_PRELOADING other libraries, but > I haven't tested. > > Namely, we get the Sid_map::Sid_map constructor firing before > my_thread_global_init() is run. What happens here is that > Sid_map::Sid_map calls a DBUG function, which will try to get a thread > specific variable for THR_KEY_mysys, but the thread key hasn't yet been > initialized, so instead we get a wonderful pile of garbage. > For what it's worth, I think the best thing here is to not use DBUG at all inside constructors of static objects, let's not rely on the order of initialization. This problems keeps popping up again and again, it might be worth tweaking DBUG to abort if used inside a constructor. Regards, Davi -- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals