Bug 64113 - Output mangled when multiple child processes write to standard out
Summary: Output mangled when multiple child processes write to standard out
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc3
Version: 7.2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-04-25 20:54 UTC by Tim Korsrud
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-12-15 20:06:05 UTC
Embargoed:


Attachments (Terms of Use)
Attachment of test case that exposes the problem (745 bytes, application/octet-stream)
2002-04-25 20:55 UTC, Tim Korsrud
no flags Details

Description Tim Korsrud 2002-04-25 20:54:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Description of problem:
When a parent process starts up several child processes that share the same 
standard output stream, the output to cout is mangled in the output file.

Some of the child tasks are multithreaded, and the calls to cout are contained 
with in a flockfile( stdout ) and funlockfile( stout ) calls.  Output from 
multiple threads in the same task is correct; it is just output from the 
several child processes that are mangled.

I have created a test program that exposes the problem.  Ten child process are 
forked that each output the same line of text repeatedly.  All processes are 
single threaded in the test case.  The test case output is correct on g++ 2.96, 
or 2.95.

The output is not mangled on gcc 3 if the cout output operators are replaced 
with printf calls.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. make
2. ./parent
3.
	

Actual Results:  'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'
'This is the first one'Seive 
eT'
'I am ven comes next'
'
'This is the first one'
'This is the first one'
'This is h'The third process'
'The third process six'
'I guei' am number four'
'The third process'
is the nethe second'



Expected Results:  'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'Five is the next one'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'
'I guess this should be six'


Additional info:

RPMS:
gcc3-3.0.4-1
gcc3-c++-3.0.4-1
libgcc-3.0.4-1
libstdc++3-devel-3.0.4-1
libstdc++3-3.0.4-1
glibc-2.2.4-24

Comment 1 Tim Korsrud 2002-04-25 20:55:47 UTC
Created attachment 55366 [details]
Attachment of test case that exposes the problem

Comment 2 Alan Cox 2002-12-15 20:06:05 UTC
flockfile is internal to a threaded app only



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