I wrote a Cron job to kill processes that have been sleeping for too long. However, when I kill a process, it immediately respawns. What's restarting these processes? Is it a MySQL setting?
Here is the code I'm using:
db.driver.execQuery 'select * from information_schema.processlist where time > 2000', (err, threads) ->
if err? then return
if !threads? then return
for thread in threads
do (thread) ->
db.driver.execQuery 'kill ' + thread.ID, (err, response) ->
console.log 'Killed thread that was ' + thread.TIME + ' seconds old'
mysql does not retry queries, it must be the application that was running it -- the app detects the killed query as a server error, and must be immediately retrying it