-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarplogger may not report all entries #2643
Comments
I suppose this might be caused by the fact that the logger is using a BufferedPort...
|
CC @randaz81 |
I was thinking the same, but this buffered port is configured as strict (on read):
So perhaps the forwarding port (on write) is to be blamed, not the yarplogger's one. The log forwarder enables background writes:
According to the following inline doc, it does not wait for writes to complete immediately (
|
Any comment on this @randaz81 ? |
When the `forward` method is called twice, the `Bottle::clear()` method could be called before the message is sent, hence deleting the bottle being sent. This fixes the `LogForwarder` skipping messages when messages are sent too quickly (Fixes robotology#2643).
I believe that @PeterBowman is right, the problem is probably this static bottle: yarp/src/libYARP_os/src/yarp/os/impl/LogForwarder.cpp Lines 49 to 59 in efc07a7
When the I opened #2667 which fixes the issue for me (at least according to @sgiraz very useful |
When the `forward` method is called twice, the `Bottle::clear()` method could be called before the message is sent, hence deleting the bottle being sent. This fixes the `LogForwarder` skipping messages when messages are sent too quickly (Fixes robotology#2643).
Just for reference, I was wrong on this, empty Bottles are sent correctly both in binary and text form |
Hi guys! I'm reaching you because I would like to know if you have found any solution to this logging issue. Thanks! 🙏🏻 |
Nope, sorry. |
Bug description
I happened to spot an unexpected behavior concerning the tracing of operations such as
yInfo
,yWarning
,yError
etc. within theyarplogger
.If two operations are very close each other in time, I can observe that the
yarplogger
may not keep track of their invocations. In particular, the lower the time interval the higher the probability of a missed trace.To Reproduce
In order to reproduce the behavior with the smallest code snippet, I crafted a
yInfo-test
repository where you can find a simple case study (fully documented).The
yInfo-test
application contains a simple for-loop that performs 10k iterations with just one call to theyInfo
function per cycle. Note that after each iteration a yarp::os::Time::delay is also called so we can vary the elapsed time between theyInfo
calls.The test scenario foresees the use of
yarplogger
without theyarprun
broker, thus relying on theYARP_FORWARD_LOG_ENABLE=1
env var.After some quick tests, it came out that there exists a threshold of 0.001s. Below this value (included), the number of missing
yInfo
logged by theyarplogger
dramatically increases.Please, notice that the for-loop is only aimed to replicate the behavior, whereas two very close logging operations may occur wherever in the user code.
Below, you can see some results comparing what was produced by the
yarplogger
with the expected results:🔘 Click to see the result of Test 1
🔘 Click to see the result of Test 2
🔘 Click to see the result of Test 3
Expected behavior
When we call the 2 or more
yInfo
functions that are near in time, we expect to see their output as many times as they have been called. Unfortunately, if we compare the console output with that shown by theyarplogger
, we can observe that in the latter case some calls are missing.Screenshots
In the following screenshot we can see that
yarplogger
missed to capture theyInfo
with counter value 298.Configuration (please complete the following information):
Additional context
While I was providing a solution for the following assignments:
assignment_yarp-find-rgb
assignment_make-it-roll
I was trying to debug the application using the
yInfo
functions to inspect the coverage of my code. Putting theyInfo
calls before and after some instructions or code blocks, and looking atyarplogger
, it seemed that some code blocks were never executed. However, after I had tried to run the code using only the console, I realized that theyarplogger
was not showing all the information as it should have done.As suggested by @pattacini and @traversaro, we did the test also in the configuration where we employ the
yarprun
as a broker in place of the localhost.In this case, the results seem better (less traces missed), but the problem persists as the delay time decreases. I also noticed the
yWarning
andyError
seem more rugged and reliable than theyInfo
; maybe, this is due to a possible priority mechanism, I suppose.The text was updated successfully, but these errors were encountered: