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

[BUG] Statistics are not saved, starting from zero after restart of the docker image #133

Open
daniel-l opened this issue Apr 27, 2024 · 6 comments · Fixed by #135
Open
Assignees
Labels
bug Something isn't working

Comments

@daniel-l
Copy link

Describe the bug
Statistics are not saved, starting from zero after restart of the docker image.

To Reproduce
Steps to reproduce the behavior:

  1. Use Zoraxy, accessing reverse proxied services.
  2. Statistics get generated (number of "Req. Today" etc.)
  3. Restart Zoraxy's docker image
  4. Statistics are reset and start from zero.

Expected behavior
Statistics get saved and are loaded after every restart of the docker image.

Additional context
The docker image is setup with a volume to save data/config across sessions:

    volumes:
      - ./zoraxy:/opt/zoraxy/config/

Configs like the set up proxy hosts and custom access lists get saved there; stats not so much.

@daniel-l daniel-l added the bug Something isn't working label Apr 27, 2024
@PassiveLemon
Copy link
Collaborator

I believe this would depend on how Zoraxy itself caches statistics. If it caches to a specific location, you could create a volume for it. I'll have to wait and see what Toby says to know for sure

@tobychui
Copy link
Owner

Cannot reproduce this bug while running Zoraxy natively without docker.

@PassiveLemon For your information, the statistic is stored in memory and only write to sys.db on either the daily ticker ticks (everyday at midnight), or when the application receives an os.Interrupt or syscall.SIGTERM signal (e.g. Ctrl +C on a running terminal window). You might want to check if the application is shutdown correctly or if the sys.db is persistence after restart.

@daniel-l
Copy link
Author

daniel-l commented Apr 28, 2024

The file sys.db already existed yesterday; I just checked if the modified time updated since:

$ ls -al sys.db
-rw------- 1 root root 12288028. Apr 02:00 sys.db

The file also grew a bit since yesterday.

Also, I just shut down and restarted the container - yesterday's stats were indeed saved. Everything since (today's stats) were thrown away - the file did not grow a bit. File info after the restart:

$ ls -al sys.db
-rw------- 1 root root 12288028. Apr 11:43 sys.db

@tobychui
Copy link
Owner

Ok, this surely seems like a "docker not gracefully closing zoraxy" issue. I will let @PassiveLemon take over from here. Thanks for the bug report!

@PassiveLemon
Copy link
Collaborator

That would make sense, there is no graceful shutdown implemented in the container. Docker sends out a SIGTERM to the running process (shell in this case) but it doesn't respond to it so, after the grace period, it SIGKILLs everything which would result in an improper save.

@CorneliusCornbread
Copy link

This seems to be happening again with Zoraxy 3.0.4, works fine on 3.0.3

@PassiveLemon PassiveLemon reopened this May 18, 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

Successfully merging a pull request may close this issue.

4 participants