4.9 MIT-pthreads notes

This section describes some of the issues involved in using MIT-pthreads.

Note that on Linux you should NOT use MIT-pthreads but install LinuxThreads! 4.11.5 Linux notes (all Linux versions).

If your system does not provide native thread support, you will need to build MySQL using the MIT-pthreads package. This includes most FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some others. 4.2 Operating systems supported by MySQL.

  • On most systems, you can force MIT-pthreads to be used by running configure with the --with-mit-threads option:
    shell> ./configure --with-mit-threads
    Building in a non-source directory is not supported when using MIT-pthreads, because we want to minimize our changes to this code.
  • MIT-pthreads doesn't support the AF_UNIX protocol used to implement Unix sockets. This means that if you compile using MIT-pthreads, all connections must be made using TCP/IP (which is a little slower). If you find after building MySQL that you cannot connect to the local server, it may be that your client is attempting to connect to localhost using a Unix socket as the default. Try making a TCP/IP connection with mysql by using a host option (-h or --host) to specify the local host name explicitly.
  • The checks that determine whether or not to use MIT-pthreads occur only during the part of the configuration process that deals with the server code. If you have configured the distribution using --without-server to build only the client code, clients will not know whether or not MIT-pthreads is being used and will use Unix socket connections by default. Since Unix sockets do not work under MIT-pthreads, this means you will need to use -h or --host when you run client programs.
  • When MySQL is compiled using MIT-pthreads, system locking is disabled by default for performance reasons. You can tell the server to use system locking with the --use-locking option.
  • Sometimes the pthread bind() command fails to bind to a socket without any error message (at least on Solaris). The result is that all connections to the server fail. For example:
    shell> mysqladmin version
    mysqladmin: connect to server at '' failed;
    error: 'Can't connect to mysql server on localhost (146)'
    The solution to this is to kill the mysqld server and restart it. This has only happened to us when we have forced the server down and done a restart immediately.
  • With MIT-pthreads, the sleep() system call isn't interruptible with SIGINT (break). This is only noticeable when you run mysqladmin --sleep. You must wait for the sleep() call to terminate before the interrupt is served and the process stops.
  • When linking you may receive warning messages like these (at least on Solaris); they can be ignored:
    ld: warning: symbol `_iob' has differing sizes:
        (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
    file /usr/lib/libc.so value=0x140);
        /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
    ld: warning: symbol `__iob' has differing sizes:
        (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
    file /usr/lib/libc.so value=0x140);
        /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
  • Some other warnings also can be ignored:
    implicit declaration of function `int strtoll(...)'
    implicit declaration of function `int strtoul(...)'
  • We haven't gotten readline to work with MIT-pthreads. (This isn't needed, but may be interesting for someone.)