Bug 127060 - Program waiting for a semaphore are interrupted when attached from gdb.
Program waiting for a semaphore are interrupted when attached from gdb.
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gdb (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Elena Zannoni
Jay Turner
Depends On:
  Show dependency treegraph
Reported: 2004-07-01 04:28 EDT by Fabrizio Muscarella
Modified: 2015-01-07 19:08 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-07-14 13:03:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
see bug description (1001 bytes, text/plain)
2004-07-01 04:31 EDT, Fabrizio Muscarella
no flags Details

  None (edit)
Description Fabrizio Muscarella 2004-07-01 04:28:50 EDT
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):

How reproducible:

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.

Additional info:

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
Comment 1 Fabrizio Muscarella 2004-07-01 04:31:16 EDT
Created attachment 101556 [details]
see bug description
Comment 2 Fabrizio Muscarella 2004-07-14 13:05:37 EDT

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.

Note You need to log in before you can comment on or make changes to this bug.