|
Bugzilla – Full Text Bug Listing |
| Summary: | Segfault when deleting a TCP socket in the "connection fail callback" | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Gustavo J. A. M. Carneiro <gjcarneiro> |
| Component: | internet | Assignee: | ns-bugs <ns-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Gustavo J. A. M. Carneiro
2008-02-04 13:47:49 UTC
I see some lines like:
m_retxEvent = Simulator::Schedule (rto,&TcpSocket::ReTxTimeout,this);
Most likely there's a scheduled event that was not properly cancelled in the socket destructor.
*sigh* Why doesn't anyone believe me when I say that EventGarbageCollector is needed? :-(
Patch to fix the bug: diff -r a1edfbcca81d src/internet-node/tcp-socket.cc --- a/src/internet-node/tcp-socket.cc Mon Feb 04 14:15:18 2008 +0000 +++ b/src/internet-node/tcp-socket.cc Mon Feb 04 18:53:38 2008 +0000 @@ -121,6 +121,7 @@ TcpSocket::Destroy (void) m_node = 0; m_endPoint = 0; m_tcp = 0; + m_retxEvent.Cancel (); } int TcpSocket::FinishBind (void) Pushed Gustavo's fix as revision 2315 in ns-3-dev (changeset df5e3f1d2a1a) I found another similar segfault today. I am not sure how to reproduce, though. Raj, do you mind moving the "m_retxEvent.Cancel ();" from Destroy() to ~TcpSocket()? I tried it locally, and it seems to fix the issue for me... (In reply to comment #4) > I found another similar segfault today. I am not sure how to reproduce, > though. > Raj, do you mind moving the "m_retxEvent.Cancel ();" from Destroy() to > ~TcpSocket()? I tried it locally, and it seems to fix the issue for me... > Please feel free to push your change...I'm not sure I understand the issue of moving the location of the canceling of the event, but if it fixes a segfault then please do. (In reply to comment #5) > (In reply to comment #4) > > I found another similar segfault today. I am not sure how to reproduce, > > though. > > Raj, do you mind moving the "m_retxEvent.Cancel ();" from Destroy() to > > ~TcpSocket()? I tried it locally, and it seems to fix the issue for me... > > > > Please feel free to push your change...I'm not sure I understand the issue of > moving the location of the canceling of the event, but if it fixes a segfault > then please do. > The issue is that, if you look at ~TcpSocket, you'll see that not all code paths lead to Destroy() being called, i.e. it appears (on the surface) possible for a TcpSocket to be freed without calling the Destroy() method first. Fix pushed as 2318:d4217d7ba4ba. |