Bug 2815 - Config::Connect should throw warnings when trace is not found
Config::Connect should throw warnings when trace is not found
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3-dev
All All
: P3 minor
Assigned To: Peter Barnes
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-04 14:44 UTC by Tommaso Pecorella
Modified: 2020-05-04 09:52 UTC (History)
2 users (show)

See Also:


Attachments
proposed patch (1.67 KB, patch)
2017-11-04 14:44 UTC, Tommaso Pecorella
Details | Diff
test program (17.62 KB, text/x-csrc)
2017-11-04 14:44 UTC, Tommaso Pecorella
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tommaso Pecorella 2017-11-04 14:44:24 UTC
Created attachment 2946 [details]
proposed patch

Well, this is a long-standing issue. Users misspell something and a trace is not fired.
My solution: add a NS_LOG_UNCOND warning when the target is not found.

The patch is attached, but... it fires too much.

If one runs he examples (attached), the result is:

No trace found for fancoil
No trace found for TxRxPointToPoint
No trace found for Tx
No trace found for Rx
No trace found for Tx
No trace found for Rx
No trace found for PhyTxBegin
No trace found for PhyRxBegin
No trace found for RemainingEnergy
No trace found for Enqueue
No trace found for Enqueue
No trace found for Dequeue
No trace found for Dequeue
No trace found for Drop
No trace found for Drop
No trace found for PhyTxBegin
No trace found for PhyRxBegin
No trace found for MacTx
No trace found for MacTxDrop
No trace found for MacRx
No trace found for MacRxDrop
No trace found for PhyTxBegin
No trace found for PhyRxBegin

The first is my test - I called a non-existent thing.
The others are artifacts, it seems that in our codebase WE are calling bogus stuff.

What's the source? Mystery (to be solved).
Comment 1 Tommaso Pecorella 2017-11-04 14:44:56 UTC
Created attachment 2947 [details]
test program
Comment 2 Peter Barnes 2020-02-26 18:51:03 UTC
This patch logs unconditionally when a trace path doesn't exist.

We also provide FailSafe versions of Config::Connect and
Config::ConnectWithoutContext.  These should be used when you
can't be sure that a trace path exists in the current model.

This resolves the warnings from AnimationInterface::ConnectCallbacks()

Credit to "InquisitivePenguin (GCI 2019) <>" for diagnosing this issue,
opening the way to a solution.

Upstream merge request
https://gitlab.com/nsnam/ns-3-dev/-/merge_requests/201
Comment 3 Tom Henderson 2020-05-04 09:52:02 UTC
merged on May 1, commit 5879700a