Question

I have an active running process on Linux/FreeBSD. I have traced it, and found that one of the threads is blocked on the call to the function write() - as an argument it has a TCP socket. It's may be hanging for hours.

What are the ways to examine the reasons behind the blocked write()? What are the potential problems?

P.S. System utilities are appreciated.

Was it helpful?

Solution

In my current case there was the following problem. The DNS resolution gave me some IP-address, that was far-far away, or even unreachable. The write() was hanging because no TCP response was ever received from that host.

The problem is solved by setting timeout on send operations via setsockopt and SO_SNDTIMEO.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top