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

Logdir fixes #4344

Closed
wants to merge 6 commits into from
Closed

Logdir fixes #4344

wants to merge 6 commits into from

Conversation

richcarl
Copy link

Ensures that log files and directories are not created when running in foreground mode.
Closes #3860

@richcarl richcarl requested review from uwiger and dincho April 29, 2024 14:58
Copy link
Member

@dincho dincho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of issues as we already discussed:

  • foreground doesn't handle CRTL+C which is a must in interactive usage and for orchestrators
  • the default log level should be INFO instead of DEBUG as it was for console output

@richcarl
Copy link
Author

richcarl commented May 6, 2024

Turns out that Erlang actually handles SIGTERM these days as equivalent to running init:stop(), so plain docker stop will do a clean shutdown. Good to know.

@dincho Do you have some reference you can point me to that states clearly what is expected with regard to SIGINT in Docker?

@dincho
Copy link
Member

dincho commented May 7, 2024

I don't think that this is docker specific, this is general UNIX/POSIX process expectations. When you hit CRTL+C you expect the process to stop "immediately" or you (at least me) never run that crap again.

@dincho
Copy link
Member

dincho commented May 7, 2024

Turns out that Erlang actually handles SIGTERM these days as equivalent to running init:stop(), so plain docker stop will do a clean shutdown. Good to know.

I guess the process doesn't stop on time then and get's killed: https://docs.docker.com/reference/cli/docker/container/stop/#description

@richcarl
Copy link
Author

richcarl commented Jun 3, 2024

I don't think that this is docker specific, this is general UNIX/POSIX process expectations. When you hit CRTL+C you expect the process to stop "immediately" or you (at least me) never run that crap again.

To clarify things: Running bin/aeternity foreground (as in my change) passes -noinput +Bd to erl, and that makes it behave just as you want. (Without +Bd, the default behaviour of erl is that it will install a break handler, which brings up the Erlang BREAK menu on Ctrl-C - not what you want.) Perhaps you are thinking about +Bi, which would make it ignore Ctrl-C, but that is not what I'm doing here. So running as foreground should be correct.

In any case, Ctrl-C sends SIGINT, but tools like Docker don't send SIGINT - only the terminal uses that signal. Docker sends SIGTERM first to tell the program to stop, and then SIGKILL if nothing happens in about ten seconds.

Copy link
Member

@dincho dincho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to continue arguing on the signal handling in this PR as it is logs related.

Please take out the proposed change in separate PR if you think that would fix a problem, however as we discussed and I wrote in this PR the proposed change actually BREAKS the expected behaviour, regardless of the reason.

@richcarl richcarl closed this Jun 13, 2024
@richcarl
Copy link
Author

This can't be fixed right now because of how the test suites work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Foreground mode should not write to log files
2 participants