1831950 Members
2924 Online
110034 Solutions
New Discussion

pthread & accept() issue

 
Cherry Wang
New Member

pthread & accept() issue

I have a piece of multi-threaded server code written with dce threads and compiled on HP-UX 10.20 running on HP-UX 11.11. I'm running into an issue where if the process has been running for a while (> 8 hours), it's freezing up on the "accept()" call. When I look at the core dump, it's showing the following stack:

1) _accept_sys+0010
2) cma_accept+02d8
3) tcp_start (this is my code)
4) cma__thread_base+0204
5) cma__thread_start1+0034
6) cma_thread_start0+0034

When the process first starts, clients can connect & disconnect at will and everything is OK. After a couple of hours, a client will disconnect and then reconnect and the whole process freezes.

Help?

The point in my code where the freeze up happens looks like this:

while (1) {
if ((temp_socket = accept(listen_socket, &client_addr, &client_addr_len)) <= 0) {
....
}
...
}

How can I look at what each thread is doing at the time of the core dump?
1 REPLY 1
Laurent Menase
Honored Contributor

Re: pthread & accept() issue

Hi,
The libcma threads are user level threads, so
if there is a thread blocked on accept() syscall, which is your case, the program can't do anything until the accept() is wakenup by a new incoming connection.

Now you have 2 possibility:
- You have incoming connnections, but the process stay hung on accept, then you should check that you do not have a too old ARPA transport patch.
PHNE_23645 for instance

-you don't have incoming connections, and then the question is why the application go on accept().

you can use tusc on the applucation to trace the syscall of the process just before it got hung