log-viewer icon indicating copy to clipboard operation
log-viewer copied to clipboard

bug when searching backwards for word

Open wnleao opened this issue 3 years ago • 8 comments

This error occurs when searching backwards for a given term. It's deterministic, it always happens when reaching the line starting with "2021-03-25 07:02:04.456 INFO 123695 ". The problem appears to be caused due to the overlapping time range of the new retrieved records with the current ones.

The assertion below is triggered.

// file: record-renderer.service.ts
if (end < m.length) {
    SlUtils.assert(Record.compareTo(m[end - 1], m[end]) < 0);
}

wnleao avatar Apr 17 '21 22:04 wnleao

Thank you for the bug report. I don't understand how is it possible. If you search bak from "2021-03-25 07:02:04.456", the backend must return records older than "2021-03-25 07:02:04.456", but it returns "2021-03-25 07:07:33.510". Could you attach or send me the log sample to reproduce? ([email protected])

sevdokimov avatar Apr 18 '21 07:04 sevdokimov

Yeah, it looks like an off-by-one kind of problem. I've also changed the issue assignee to you, ok?

To reproduce the error, open the logfile, press Home, search for 'quartz', go forward a few times until you reach the given time spot, go forward one more time and backwards.

wnleao avatar Apr 18 '21 16:04 wnleao

The attached log contains disordered records. There are the following records:

2021-03-25 07:02:04.402 DEBUG 123695 --- [freshExecutor-0] 2021-03-25 07:02:04.402 DEBUG 123695 --- [tbeatExecutor-0] 2021-03-25 07:02:33.510 DEBUG 123695 --- [tbeatExecutor-0] 2021-03-25 07:02:04.456 INFO 123695 --- [_MisfireHandler] 2021-03-25 07:02:33.510 DEBUG 123695 --- [ scheduling-1] 2021-03-25 07:02:33.510 DEBUG 123695 --- [-auto-1-exec-10]

Looks like the bold record must upper than 2021-03-25 07:02:33.510 , how does it possible?

sevdokimov avatar Apr 19 '21 17:04 sevdokimov

Nice catch there. It may be due to the log level, just a guess. The record that is out of place is INFO.

wnleao avatar Apr 21 '21 16:04 wnleao

Check this out: https://stackoverflow.com/questions/586824/why-are-my-log4j-log-file-timestamps-out-of-order-and-how-do-i-fix-it in fact, there are multiple threads writing to same log file.

wnleao avatar Apr 21 '21 17:04 wnleao

It's sad... I have to make log-viewer tolerant to record disorder.

sevdokimov avatar Apr 22 '21 05:04 sevdokimov

Yeah... I've actually seen that before, but I've never realized how common it is. I went through some of my log files in production and I saw several cases of that.

wnleao avatar Apr 22 '21 23:04 wnleao

LogViewer 0.1.7 works correctly with logs containing disordered messages, but if you have one opened log only.

sevdokimov avatar Jun 13 '21 22:06 sevdokimov