Bug 1220 - FdReader always stops with NS_FATAL_ERROR
FdReader always stops with NS_FATAL_ERROR
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P5 normal
Assigned To: Tom Goff
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-16 18:35 EDT by alina
Modified: 2011-08-16 14:39 EDT (History)
3 users (show)

See Also:


Attachments
Validate m_stop in inner FdReader::Run() loop to prevent NS_FATAL_ERROR (559 bytes, patch)
2011-07-16 18:35 EDT, alina
Details | Diff
Code used to test the problem. (1.33 KB, text/x-c++src)
2011-07-16 18:37 EDT, alina
Details
Proposed fix (1.96 KB, patch)
2011-08-16 11:48 EDT, Tom Goff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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