-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix stack overflow triggered by casefolding script #405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've said this elsewhere, but I'm super dubious about having parse_config_file
set up logging anyway. Can we just leave logging unconfigured (or better, configured to a hardcoded default which just writes the logs to stderr) until parse_config_file
completes, and then call setup_logging
from sydent.py
?
I agree that this wasn't a great setup.. I've now added a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing the config file twice seems a bit grim. I'm not really following why it's so important to fully configure the logging before we parse the config file for real?
My thought was: it's a bad thing for output to not all go to the same place. Say someone had configured Sydent (running in a docker container for example) and had setup something to follow the logs, wouldn't it be confusing if some output was missing? E.g. the warning telling the user to setup their server name to something more sensible. A better way to do what I'm trying to do might be to have logging configured in a seperate file. |
A docker container is probably a bad example: in that case, it's normal to have your application send everything to stdout/stderr, and let the docker runtime deal with it. If you're not running in a docker container, then I think it's reasonable for errors that happen during startup (and thus prevent proper startup) to go to the console, while later errors go to a logfile. That's what most server processes do. Indeed, if errors during startup only go to a logfile, then it's pretty confusing when you start the process, since you can't tell if it started successfully or not. |
Thank you for explaining! That makes a lot of sense. I've moved all the logging output from the config parsing to using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
sydent/sydent.py
Outdated
) | ||
handler.setFormatter(formatter) | ||
|
||
def sighup(signum, stack): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't your fault, but this doesn't seem to be used anywhere 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I removed that at some point in a seperate PR but might as well do it here instead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might have been better to leave it, and wire it up correctly, but never mind :)
Fix stack overflow triggered by casefolding script (added in commit 5f90f62)
Logging was setup too many times. This adds option to ignore logging config options when parsing config files (so you can do that seperately)