Bug 1220

Summary: FdReader always stops with NS_FATAL_ERROR
Product: ns-3 Reporter: alina <aquereilhac>
Component: coreAssignee: Tom Goff <tgoff>
Status: RESOLVED FIXED    
Severity: normal CC: mathieu.lacage, ns-bugs, tomh
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Validate m_stop in inner FdReader::Run() loop to prevent NS_FATAL_ERROR
Code used to test the problem.
Proposed fix

Description alina 2011-07-16 18:35:47 EDT
Created attachment 1204 [details]
Validate m_stop in inner FdReader::Run() loop to prevent NS_FATAL_ERROR

Validation is missing on m_stop in the inner loop of FdReader::Run(), to avoid always stopping with NS_FATAL_ERROR.

This same bug is also present in ns-3.11.
Comment 1 alina 2011-07-16 18:37:29 EDT
Created attachment 1205 [details]
Code used to test the problem.

Code to test the problem.
Comment 2 Tom Goff 2011-08-16 11:48:48 EDT
Created attachment 1220 [details]
Proposed fix

I think the main issue is that the event pipe can be closed before the
read thread completes.

This patch closes the event pipe file descriptor after joining the
read thread to avoid a possible race condition.  It also makes error
handling less permissive by treating most read errors as fatal.
Comment 3 Tom Henderson 2011-08-16 12:25:58 EDT
(In reply to comment #2)
> Created attachment 1220 [details]
> Proposed fix
> 
> I think the main issue is that the event pipe can be closed before the
> read thread completes.
> 
> This patch closes the event pipe file descriptor after joining the
> read thread to avoid a possible race condition.  It also makes error
> handling less permissive by treating most read errors as fatal.


This patch does not apply against ns-3-dev.  Could you please produce one that does?
Comment 4 Tom Henderson 2011-08-16 14:39:28 EDT
changeset:  17902e1844be