tracing and identifying connection problems with mysql libraries

we are currently running a custom build of mysql 5.1.24-rc with no source changes (only configuration changes), running on Centos 5 / AMD64

A custom appliation makes use of a connection pool, using the threaded library (statically linked), but we are finding that occassionally the application is crashing during execution of prepared statements, due to connections being lost.

what would be the best way to determine what is causing the crash. It is likely that the connections are expiring and so prepared statements are lost. I have increased connection timeout limits, but still having an issue, even after a relatively short period of time (within an hour or 2 of the thread pool being initialised).

any advice or guidelines on how to address this?

Maybe you can watch the traffic with tcpdump and watch what happens. If you attach tcpdump, execute a query, and note the client port then you can reattach and filter by that port so you see only the traffic for that connection. That should be a pretty easy way to see what happens.