Bug #9595
logs are not flushed completely
| Status: | Merged - Pending Release | Start date: | 09/19/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | logging | |||
| Target version: | 2.7.14 | |||
| Affected Puppet version: | 0.22.1 | Branch: | https://github.com/puppetlabs/puppet/pull/496 | |
| Keywords: | flush log | |||
| Votes: | 0 |
Description
the puppet and puppet master (v. 2.7.1) logs are not flushed properly to the files. when puppet/puppetmaster is logging through syslog, all is logged properly. if I switch to logging to the file /var/log/puppet/puppet.log, the file is often cut in the middle of the word, e.g.:
[root@server2 manifests]# tail -2 /var/log/puppet/masterhttp.log [2011-09-19 09:12:32] - -> /production/file_metadata/files/config/jpackage50.repo? [2011-09-19 09:12:33] testsrv.domain.com - - [19/Sep/2011:09:12:33 PDT] "PUT /production/r[root@server2 manifests]#
Related issues
History
Updated by James Turnbull 8 months ago
- Status changed from Unreviewed to Needs More Information
I am pretty sure this is a duplicate of an existing issue. Will try to find it.
Updated by Radosław Antoniuk 7 months ago
- Affected Puppet version changed from 2.7.1 to 2.7.5
what more information do you need?
Updated by James Turnbull 7 months ago
Mostly I think this is a duplicate issue – not that I can find the dup issue. :)
Updated by Josh Cooper 3 months ago
I just ran into this also. You have to explicitly set autoflush when using a file log destination, otherwise log output may be buffered until the next log message is written. There have been some issues (#4139) with the --autoflush command line argument, but it should be fixed in the version you are using
Updated by Josh Cooper 3 months ago
- Status changed from Needs More Information to Accepted
- Assignee set to Josh Cooper
- Target version set to 2.7.x
When logging to a file, puppet should always flush the message in the fflush sense, not the fsync sense. It shouldn’t require users to enable autoflush
Updated by Daniel Pittman 3 months ago
Josh Cooper wrote:
When logging to a file, puppet should always flush the message in the fflush sense, not the fsync sense. It shouldn’t require users to enable autoflush
…this is nice, but isn’t the root cause of the problem on Windows. Ruby will flush internal buffers safely when it shuts down in the normal case, so something on Windows is causing it to exit uncleanly, or without the normal cleanup from triggering that flush.
Updated by Josh Cooper 3 months ago
Daniel Pittman wrote:
…this is nice, but isn’t the root cause of the problem on Windows. Ruby will flush internal buffers safely when it shuts down in the normal case, so something on Windows is causing it to exit uncleanly, or without the normal cleanup from triggering that flush.
Yep. On Unix, the daemon.stop method gets called to cleanly shutdown, but the same is not true when running puppet agent via third-party service wrapper. I’ll file a separate ticket for that. Likely we will need to register a console ctrl handler, SetConsoleCtrlHandler, and close the logs, etc.
Updated by Josh Cooper 3 months ago
- Status changed from Accepted to In Topic Branch Pending Review
- Affected Puppet version changed from 2.7.5 to 0.22.1
- Branch set to https://github.com/puppetlabs/puppet/pull/496
The autoflush behavior has been this way since it was introduced in https://github.com/puppetlabs/puppet/commit/133c17fa6665256cafdcd1cf76d2ae50233c44f4 circa 0.20.0. I’m changing the affected puppet version to the version closest to that.
Updated by Josh Cooper 3 months ago
- Status changed from In Topic Branch Pending Review to Code Insufficient
Talked this over with Daniel and we’d like to eliminate the autoflush option altogether.
Updated by Josh Cooper 2 months ago
Recently ran into a support case where the customers were using the —autoflush option, so we definitely will need a deprecation cycle for this option.
Updated by Josh Cooper 8 days ago
- Status changed from Code Insufficient to Merged - Pending Release
- Assignee changed from Josh Cooper to Andrew Parker
- Keywords set to flush log
Andy fixed this in commit https://github.com/puppetlabs/puppet/commit/72d3b564741b916960f520ca3c20733a7efbaaa7 which was merged into 2.7.x as part of fixing #8174 as https://github.com/puppetlabs/puppet/commit/849a882d0914e305547d566471f1027102bbfba5
Log files should automatically write everything to disk eagerly or else we could lose data. If a user wants to not autoflush for performance reasons they can turn that off.
Updated by Josh Cooper 8 days ago
- Target version changed from 2.7.x to 2.7.14
This was actually fixed in 2.7.14.