AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
25.13k stars 1.8k forks source link

The query log refreshes itself, goes back to the beginning and into the future ! #2293

Closed mgcWil closed 3 years ago

mgcWil commented 3 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Issue Details

Expected Behavior

Actual Behavior

Hello! I also notice strange behaviors of the query log which can go in an infinite loop without using the mouse wheel, refresh itself completely by itself and go back to the beginning, making any progress impossible !

I also notice inconsistencies in the chronology, sometimes the following lines indicate a more recent time !

My AGH is incrementing a TXT log, non verbose, I found many lines with "[error] Couldn't find timestamp:". I finally noticed that this incrementing is done when consulting the query log with the scroll wheel, see the screenshots.

Screenshots

Screenshot: "Back to the future !" ![Scroll_of_Log_capture_1 93](https://user-images.githubusercontent.com/53054629/98791076-d069dd00-2404-11eb-9da9-4ef439528779.png) ![Scroll_of_Log_capture_2 150](https://user-images.githubusercontent.com/53054629/98791270-1757d280-2405-11eb-8196-b3536a46b27b.png) ![Scroll_of_Log_capture_3 247](https://user-images.githubusercontent.com/53054629/98791273-1888ff80-2405-11eb-8fa9-1c9b28fe69d5.png) ![Scroll_of_Log_capture_4 361](https://user-images.githubusercontent.com/53054629/98791276-1888ff80-2405-11eb-8eb4-6be1da6c139f.png) Real-time incrementing of the TXT journal with lines "[error] Couldn't find timestamp:" ![Bug_Query_Log_view_txt](https://user-images.githubusercontent.com/53054629/98791376-43735380-2405-11eb-8a6f-c3da01aa15aa.gif) Infinite loop without using the mouse wheel, the scrollbar or the keyboard ! ![Scroll_Auto_of_Query_Log](https://user-images.githubusercontent.com/53054629/98791857-f04dd080-2405-11eb-9494-c517915f2a21.gif)

Additional Information

I had noticed these problems with the beta 0.104.0-beta3, and found that the query log could not be exploitable, seeing that the navigation buttons had disappeared in the version 0.104.0, I thought that the bugs had been fixed...

For me, it's back to 0.103.0, whose query log has some problems too, but less catastrophic.

I wanted to bring my little contribution, especially in image and my feeling.

I do not doubt that a solution will be found, I hope quickly (but I will be patient) in the form of a patch on this version 0.104 ? Maybe, in the meantime ; good work to all and thank you ;)

ameshkov commented 3 years ago

My AGH is incrementing a TXT log, non verbose, I found many lines with "[error] Couldn't find timestamp:".

Please check the "edge" channel build, this issue has been fixed there.

mgcWil commented 3 years ago

version v0.104.0-SNAPSHOT-3cc5bf21 installed in another folder, started (without data folder), and tested : 1- The lines "[error] Couldn't find timestamp:" don't appear in the TXT log, OK, 2- but the inconsistencies in the chronology still exist :( Scroll_of_Log_capture_5-6-7-8 3- The query log has completely refreshed to go back to the beginning as soon as the end (or rather the beginning) of the records reached ! :(

ainar-g commented 3 years ago

Hi! The query log fix landed after that snapshot. Please try the newly released v0.104.1, it should fix that issue.

mgcWil commented 3 years ago

Well, v0.104.1 installed (update from v0.104.0), started (without data folder), and tested : Positive points : 1- The lines "[error] Couldn't find timestamp:" really don't appear in the TXT log anymore, cool ! 2- The query log did NOT refresh completely to go back to the beginning as soon as the end (or rather the beginning) of the records reached, cool again !

But, the negative point: The inconsistencies in the chronology still exist, not cool, arf :(

Scroll_of_Log_capture_10-11

ameshkov commented 3 years ago

The query is written to the log when it has been processed (so they are ordered by "end time"). But the time you're seeing in the log is the time when the query processing has been started.

mgcWil commented 3 years ago

Okay, I didn't know that. It's hard to take in, but I get it. So it's not a bug at all ? To avoid misunderstandings, and improve readability, wouldn't it be simpler if the log shows us the "end time", just ?

ameshkov commented 3 years ago

Yeah, that's generally not a bug, but there are ways to mitigate this.

mgcWil commented 3 years ago

OK, so the query log shows us the time at which the processing of the request was launched (the demand), classifying these requests by order of processing (the response), did I understand correctly ?

By saying "there are ways to mitigate this" what do you mean ? 1- that response times can be improved ? On the AGH side, Upstream... (my self-esteem just took a hit there :) ) 2- that the query log could display requests by processing order only (the response), or the reverse (but it might be less relevant, my moldy Upstreams have random response times) ? And here it concerns you, the coders, AH ! (My ego is already better there !) 3- one or other ways ?

What's up? Take the time to answer me, there's no hurry, there's no bug (just my bad Upstreams and a strange query log...) ! ;)

ameshkov commented 3 years ago

The queries are buffered in-memory before they're dumped into the query log file. We could keep them sorted at that point. There's still a probability that the query that's processed right after the buffer is dumped will get out of sort.

mgcWil commented 3 years ago

OK, I understand that here you are expressing that you could make an improvement ?

I will persist in the Bug ! I made a short extraction from the query log, keeping only the "Time" column, then numbered in chronological order each displayed line. Using a simple formula in a spreadsheet, I wanted to highlight the time differences. The result is :

No screenshot this time, but two XLSX. Copie_Query_Log.xlsx Copie_Query_Log_local.xlsx

ameshkov commented 3 years ago

Maybe. We're planning to take a deeper look into it anyway so your input would be useful.

mgcWil commented 3 years ago

Great 👍 Here's another extraction, at a different time, the results are identical to the first one. Copie_Query_Log_local_2.xlsx

I wanted to make another one from the query log of the first machine, but I couldn't do it ! AGH has been running since 19H yesterday, it hasn't restarted since, and the query log doesn't show me anything before 14:02:44 today on the "All queries" filtering. On the other hand, it goes further with the "Processed" filtering ! Damn animal !

Query_Log_Stop_Charg

Thank you !

ainar-g commented 3 years ago

We've added a small mitigation in snapshot 6e615c6. Unfortunately, we will probably only be able to fix the issue after #2290 is solved.

ainar-g commented 3 years ago

We will close this issue now, as there will be a lot more work done to make the query log more reliable in #2554.