Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to track down a hit-or-miss bug in a web application. Sometimes a request completes just fine; sometimes it hangs and never finishes.

I see that Apache now has several requests listed on the server-status page as "sending reply," and that doesn't change. I'm testing on localhost, so there shouldn't ever be more than one.

Out of curiosity, I set MySQL to log all queries and I'm tail -fing the log file.

When things go OK, I see a pattern like this:

20 Connect root@localhost on dbname
20 Query (query #1)
20 Query (query #2)
(etc)
20 Quit
21 Connect (etc)

When it hangs, I see a pattern like this:

22 Connect root@localhost on dbname
22 Query (query #1)
//nothing happens, so I try the post again
23 Connect root@localhost on dbname
23 Query (query #1)
//nothing happens; try again
24 Connect (etc)

Here's my question: is MySQL logging attempted queries, or successful queries? In other words, if the last line I see is query #1, does that imply that query #1 or query #2 is hanging?

My guess is that the one I don't see is the problem, because the last one I see looks fine, but maybe the one I don't see is too screwed-up for MySQL to process. Thoughts?

share|improve this question
add comment

1 Answer

Queries are logged as they are received, which is not necessarily the order in which they are executed. So, this means the second query never arrives.

Maybe toy arround with the slow query and/ or error logging (see chapter 5.2 of the manual) a bit to see if your first query get logged there. If not, it's likely processed normally, and the problem is within your app.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.