List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:September 3 2010 3:34pm
Subject:Re: How to avoid mysql warning "Got signal 14 from thread 0"
View as plain text  
Hi, LeeRicky!

On Sep 03, LeeRicky wrote:
> 
> If my understanding is right, I think I should delay the creation of
> all background threads util the storage engine handler's "init()"
> function is called. InnoDB also has some io background threads, but
> they are created in function "innobase_init()", just after mysql has
> initilized handled signals. Am I right ?

Yes.

Please don't execute any code before mysql asks you to initialide the
engine. This signal/mask is just one problem.

Privileges is another - MySQL juggles with root privileges to execute
most of the code as a non-privileged user, and still be able to use
memlock() when everything is initialized. By starting your code from a
static constructor you execute it with root user privileges, which
basically means completely different level of audit and security
requirements that your code should meet.

Also, if you will ever want to support dynamic loading of your engine
(with the INSTALL PLUGIN) then all static constructors will surely never
be called, MySQL only calls init() callback of a plugin.

MySQL does quite a lot to prepare execution environment before
initializing engines - mutexes, memory allocators, performance
instrumentation, command line options (current working directory too),
error messages; if you start from a static constructor you have none of
that, for example, performance instrumentation will not see your threads
(or may even misbehave).
 
Regards,
Sergei
Thread
How to avoid mysql warning "Got signal 14 from thread 0"LeeRicky3 Sep
  • Re: How to avoid mysql warning "Got signal 14 from thread 0"Sergei Golubchik3 Sep
    • Re: How to avoid mysql warning "Got signal 14 from thread 0"Marc Alff3 Sep
      • RE: How to avoid mysql warning "Got signal 14 from thread 0"LeeRicky4 Sep
Re: How to avoid mysql warning "Got signal 14 from thread 0"LeeRicky3 Sep