Skip to content
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

It froze our production server while reading a 288MB log file #64

Closed
FKPSC opened this issue May 23, 2024 · 6 comments
Closed

It froze our production server while reading a 288MB log file #64

FKPSC opened this issue May 23, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@FKPSC
Copy link

FKPSC commented May 23, 2024

I installed this log viewer on our production server after switching to pino for logging.

It took a moment to to load but it eventually loaded. I checked a couple of entries and pressed up to reload the file.

I was waiting for the file to load but I got a notification from our monitoring service that the production api server was down. I logged in to AWS to reboot the server from their EC2 dashboard. We were back online after 12 min.

300 MB is not huge for a log file. Even if it cannot handle big files, it might be good to have some check/limits and crash with a message rather than clog the whole system.

@hedhyw
Copy link
Owner

hedhyw commented May 23, 2024

Ohhh, I'm sorry to hear. I hope this didn't have any big consequences.

I will add some reasonable limit until stream reading is done: #55

@hedhyw hedhyw self-assigned this May 23, 2024
@hedhyw hedhyw added the bug Something isn't working label May 23, 2024
@hedhyw
Copy link
Owner

hedhyw commented May 27, 2024

Big memory & CPU optimization included in https://github.com/hedhyw/json-log-viewer/releases/tag/v0.4.0

What changed:

  1. We still load the whole file (because we need to filter), but JSON parsed lazily (100 rows from config).
  2. Threshold between reloads (1 second from config).
  3. Reloading indicator.
  4. Limited the maximum size of the file (1 Gb from config).
  5. I've tested it on 600Mb file. It flies, but changes are significant, so we need to use more.

Please confirm that v0.4.0 works for you as expected!

@hedhyw hedhyw closed this as completed May 27, 2024
@FKPSC
Copy link
Author

FKPSC commented Jun 1, 2024

I tried with version v0.4.0 and it still froze the whole server. I am using a staging server this time :)
I am reloading the file (hitting up multiple times) and sometimes might trigger the reloading before it is done?
Attached is a ~400MB redacted log file for you to replicate.
redacted.example.zip

PS: is there any help or version command?

@hedhyw hedhyw reopened this Jun 1, 2024
@hedhyw
Copy link
Owner

hedhyw commented Jun 1, 2024

Good idea. I will add a version command.

Did you see "reloading..." when you pressed up? Was level "INFO"?

image

Was loading fast? Please, check the video:
Screencast from 01-06-24 21:05:28.webm

@hedhyw
Copy link
Owner

hedhyw commented Jun 2, 2024

v0.5.1 should print the version in the footer

image

@hedhyw
Copy link
Owner

hedhyw commented Sep 16, 2024

fixed in #85

@hedhyw hedhyw closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants