pthreads, GDB, Segmantation fault

pthreads, GDB, Segmantation fault

Post by Andrew Ar » Sat, 27 Apr 2002 23:51:20



i have written some soft. it uses pthreads :)) Of cause, i have
checked all my pointers and all the shared data is locked with
mutex's.

This soft is very stable (72+ hours) if i compile it with 100-200
threads as thread limit, it crashes in 5 minutes if i use 400-700
threads
with "Segmentation fault". If i use 1000 threads, it crashes in 10
seconds!

i have tried GDB to find the main bug

but GDB shows some strange state:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 6193909 (LWP 5185)]
0x0804ff59 in connect_socksv4 (sockid=Cannot access memory at address
0x8
) at netio.c:143
143                     } else if ((rc = recvtimeout(sockid, (void *)
&thisrep,

(gdb) where
#0  0x0804ff59 in connect_socksv4 (sockid=Cannot access memory at
address 0x8
) at netio.c:143
Cannot access memory at address 0x0

this is the command line used for compiling:
gcc -ggdb -Wall -lpthread -D_REENTRANT

so, seems GDB have some trau8bles with stack? or? how can i debug and
what can be the trauble?

 
 
 

pthreads, GDB, Segmantation fault

Post by Jarmo Paavilaine » Sun, 28 Apr 2002 01:54:53


...

Quote:> This soft is very stable (72+ hours) if i compile it with 100-200
> threads as thread limit, it crashes in 5 minutes if i use 400-700

Do you wait for the threads (ie pthread_join(...)). If you dont youll
run out of resources. If you do not want to wait for your threads,
detach them (pthread_detach(...)).

...

Quote:> with "Segmentation fault". If i use 1000 threads, it crashes in 10

pthreads has an built in limit. I think its 1000 threads.

...

Quote:> but GDB shows some strange state:

gdb has some issues with multithreaded apps.

// Jarmo

 
 
 

pthreads, GDB, Segmantation fault

Post by Andrew Ar » Sun, 28 Apr 2002 16:16:08




> ...
> > This soft is very stable (72+ hours) if i compile it with 100-200
> > threads as thread limit, it crashes in 5 minutes if i use 400-700

> Do you wait for the threads (ie pthread_join(...)). If you dont youll
> run out of resources. If you do not want to wait for your threads,
> detach them (pthread_detach(...)).

all the threads never stop - so, i do not wait for them :))

Quote:

> ...
> > with "Segmentation fault". If i use 1000 threads, it crashes in 10

> pthreads has an built in limit. I think its 1000 threads.

it crazhes also on 900 threads, and on 500 threads - but it takes more time to crash

the limit on my server is tuned to be 2048 (glibc recompiled)

Quote:

> ...
> > but GDB shows some strange state:

> gdb has some issues with multithreaded apps.

> // Jarmo

 
 
 

1. Segmantation fault with multithreading

I have a multithrading program(daemon server) written by c++(GCC)
under AIX4.X, I get segmentation fault problem when it runs several
hours with heavy load. I want to know which compilation option or link
option I should use when I compile/link a multithreading program with
c++(GCC) under AIX 4.3. any suggestion and help will be appreciated.
Thinks in advance.

2. lex and yacc for DOS/Windows

3. Segmantation fault(core dumped)

4. support for parallel-port ZIP drive under redhat 4.2 ?

5. segmantation Fault and understanding of pointers

6. FAQ?

7. How to fix segmantation fault and broken pipes?

8. Pertec Interface for PCs ????

9. segmantation fault

10. : segmantation fault in XtString()

11. pthreads and gdb

12. gdb extension for POSIX pthreads

13. gdb & pthreads in Alpha linux 2.0.36