Bug 166000 - PATCH: Race condition on SMP
PATCH: Race condition on SMP
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: dejagnu (Show other bugs)
4
All Linux
high Severity medium
: ---
: ---
Assigned To: Petr Machata
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-15 13:36 EDT by H.J. Lu
Modified: 2015-05-04 21:32 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-02-01 10:34:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
A patch to fix race condition (1.18 KB, patch)
2005-08-15 13:36 EDT, H.J. Lu
no flags Details | Diff

  None (edit)
Description H.J. Lu 2005-08-15 13:36:59 EDT
I have seen random "make check" failures in gcc on Linux/x86-64 SMP
machines. The log file doesn't say much except for compiler exit
status 1. When I ran the failed command by hand, it was OK.

I think the problem is in lib/remote.exp:

    expect {
        -i $spawn_id -timeout $timeout -re ".+" {
            append output $expect_out(buffer)
            if { [string length $output] < 512000 } {
                exp_continue -continue_timer
            }
        }
        timeout {
            warning "program timed out."
        }
        eof {
            set got_eof 1
        }
    }

...
   set r2 [catch "wait -i $spawn_id" wres]
    if { $id > 0 } {
        set r2 [catch "close $id" res]
    } else {
        verbose "waitres is $wres" 2
        if { $r2 == 0 } {
            set r2 [lindex $wres 3]
            if { [llength $wres] > 4 } {
                if { [lindex $wres 4] == "CHILDKILLED" } {
                    set r2 1
                }

But the expect command will close the connection when it sees EOF. On
SMP machine, close the connection may send SIGHUP to the child and
cause it to exit before it can exit normally. In this case,

   set r2 [catch "wait -i $spawn_id" wres]

will return "CHILDKILLED SIGHUP hangup". This patch will make sure
that compiler will ignore SIGHUP sent by expect when it sees EOF.
Comment 1 H.J. Lu 2005-08-15 13:36:59 EDT
Created attachment 117762 [details]
A patch to fix race condition
Comment 2 Rahul Sundaram 2005-08-15 13:38:17 EDT
Thank you for the report. Setting priority to high since patch is included. 
Comment 3 Petr Machata 2006-02-01 10:34:57 EST
Thanks for the patch, I applied it and it's in rawhide.

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