Re: kill -9 again
Posted in 1994
Will Hartung - Master Rallyeist (villy@uunet.uu.net) wrote: : > From: mreed@news.hcia.com (Michael T. Reed) : > Subject: kill -9 again : > Queries from hell examples deleted : All you can really do is shut down the engine to get these to stop, : otherwise you sit back and watch the CPU time on sqlturbo soar to the : triple digits. I'm not sure which the users like most... : Has anyone else encountered Queries from Hell like this? Has anyone seem : a tbmode WORK against a query like this? I don't think I've ever seen : tbmode work against a query that wouldn't just as easily be stopped by : killing the front end job. : Will : (villy@collinscomp.com) Will, Here's one way to do a safe kill -9, if your Unix supports job control. The problem with a kill -9 is that your engine will crash if the job being killed either holds a latch or is in a critical (meaning writing to disk mainly) portion of its code. If you check this information using tbstat -u and tbstat -s you may see that the process is safe to kill. By the time you issue the kill -9 the status may change, making it unsafe to kill the job. If your Unix supports the job-control-related kills such as kill -STOP PID you can get around the problem. Say you want to kill a sqlturbo with a PID of 5678. First do a kill -STOP 5678 (as root if you need to) Then, issue "ps" commands, watching the status of job number 5678. When you "ps" output shows that the job is getting no time on the cpu, you can issue the correct tbstat commands to check whether sqlturbo #5678 either holds a latch or is in a critical portion of the code. If the sqlturbo neither holds any latches nor is in a critical portion of its code, and if the process is indeed fully stopped (you may want to do repeated ps's and tbstats until you are definitely sure that it's safe) it should be safe to kill -9 5678. If the process is stopped and the tbstats report the job to be unsafe to kill, enter the opposite of the kill -STOP command. The kill -STOP just instructed Unix to stop the process. In this case, the corresponding command is: kill -CONTINUE 5678 Sqlturbo#5678 will get computer time again. Let it run and then begin a cycle of kill -STOP 5678 and kill -CONTINUE 5678 statements, interspersed with tbstat runs to verify the safeness of the kill. When you finally get the process stopped in a safe-to-kill mode, kill it and be done with it. NOTE: This method of killing sqlturbos is DEFINITELY A LAST-DITCH means to prevent your having to bring the engine down. If it looks like you're going to have to bring down the engine to kill a rogue job, this method is worth trying. No warranties, express or implied, .......etc............. Joe -- =========================================================================== jlumbley@netcom.com (Joe Lumbley) BancTec Service Corportation 214-450-9894 Dallas, Texas Watch for my _INFORMIX DBA SURVIVAL GUIDE_ in Fall '94 from Prentice Hall! ===========================================================================