Red Hat Bugzilla – Bug 127060
Program waiting for a semaphore are interrupted when attached from gdb.
Last modified: 2015-01-07 19:08:10 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686) Gecko/20040428 Galeon/1.3.7
Description of problem:
The bug is related with gdb and system V semaphore.
A program waiting for a semaphore are interrupted if you attach gdb to
to the process and continue the execution.
I write an example to reproduce the problem.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. compile the example program with 'gcc -g3 -Wall -lpthread
-DREENTRANT -o infinite main.c'
2. start the programm
3. start gdb 'gdb <path_to_infinite>/infinite <pid_of_infinite>'
4. in gdb type continue.
Actual Results: The example program 'infinite' will exit with the
error 'sem_wait: Interrupted system call'.
Expected Results: Normally should continue to run.
The same result are reached using fork(). So the problem is not
releated with posix thread.
I founded a bug description at
but don_t exist a fix related to this bug
Created attachment 101556 [details]
see bug description
i fount the problem. If i use evaluate EINTR in a while loop the
program will work.
This is different from all other Unix Systems (i tested on HP-UX,
Solaris) but is ok, it works.