Bug 166000 - PATCH: Race condition on SMP
Summary: PATCH: Race condition on SMP
Alias: None
Product: Fedora
Classification: Fedora
Component: dejagnu   
(Show other bugs)
Version: 4
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Petr Machata
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-08-15 17:36 UTC by H.J. Lu
Modified: 2015-05-05 01:32 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-01 15:34:57 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 17:36 UTC, H.J. Lu
no flags Details | Diff

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.

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