Bug 166000

Summary: PATCH: Race condition on SMP
Product: [Fedora] Fedora Reporter: H.J. Lu <hongjiu.lu>
Component: dejagnuAssignee: Petr Machata <pmachata>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 4CC: mnewsome
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-01 15:34:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A patch to fix race condition none

Description H.J. Lu 2005-08-15 17:36:59 UTC
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 17:36:59 UTC
Created attachment 117762 [details]
A patch to fix race condition

Comment 2 Rahul Sundaram 2005-08-15 17:38:17 UTC
Thank you for the report. Setting priority to high since patch is included. 

Comment 3 Petr Machata 2006-02-01 15:34:57 UTC
Thanks for the patch, I applied it and it's in rawhide.