Download - All IT eBooks
Transcript
Crashes I discussed crashes and a general troubleshooting sequence applicable to them in “When the Server Does Not Answer” on page 39. Start by using the techniques described in the previous section: look in the error logfile, and analyze its content. This works in most cases, but this section discusses what to do if the error log does not contain enough information to help you troubleshoot the crash. The latest versions of the MySQL server can print a backtrace, even in release builds. Therefore, if the error logfile does not contain a backtrace, check whether the mysqld binary is stripped.1 (On Unix-style systems, the file command will report whether an executable file is stripped.) If it is, replace the mysqld binary with the one that came with your MySQL distribution. If you built it yourself, compile a version with symbols for use in testing. ■ Check whether the mysqld binary contains symbols, e.g., is not stripped. In some cases you may need to run a debug binary. This is a file named mysqld-debug, located in the bin directory under the MySQL installation root. The debug binary contains assertions that can help to catch the problem at an earlier stage. In this case, you probably will get a better error message because the error will be caught when the server does something wrong, rather than when a memory leak occurs. Using the release binary, you don’t get an error message until the memory leak actually leads to a crash. The price for using debug binary is a performance decrease. If the error logfile does not have enough information about the crash to help you find the source of the problem, try the two methods that follow. In any case, always work from evidence, as I did when discussing the backtrace from the error logfile in “When the Server Does Not Answer” on page 39. Don’t just make intuitive guesses, because if you try to solve a problem using a wrong guess, you can introduce even more problems. ■ Always test. Any guess can be wrong. Core file Core files contain the memory image of a process and are created (if the operating system is configured to do so) when a process terminates abnormally. You can obtain a core file by starting the MySQL server with the core option, but first you should make sure the operating system allows the file to be created. To debug using a core file, you need to be acquainted with the MySQL source code. The “MySQL Internals” page on MySQL Forge is good start. I also recommend the 1. I have seen setups where the customers manually stripped the mysqld binary to achieve better performance, so I considered it important to include this in the book. 186 | Chapter 6: Troubleshooting Techniques and Tools