diff options
author | Arne H Juul <arnej@yahoo-inc.com> | 2016-07-05 13:03:43 +0200 |
---|---|---|
committer | Arne H Juul <arnej@yahoo-inc.com> | 2016-07-05 13:03:49 +0200 |
commit | 9636d119ef9cd0f000c77164a44468beb141b14e (patch) | |
tree | e2782beebc3af3237ee0494a8acb79eb936ddd6b | |
parent | 983dd5714698d929a14a124cc1de3e4039a7ef0c (diff) |
less spurious warnings at shutdown
* the storageserver didn't like getting the TERM signal both from
runserver (via killpg) and sentinel, so it would print a warning
to stderr. But the warning didn't end with a newline.
* the line-splitter used by config-sentinel didn't handle input
that didn't end with newline before EOF well, so the warning
was never handled and sent to the vespa.log file earlier.
* only print warning if too many signals seen (> 2), and end
it with a newline.
* don't ignore last byte of input if we can avoid it.
-rw-r--r-- | configd/src/apps/sentinel/line-splitter.cpp | 6 | ||||
-rw-r--r-- | storageserver/src/apps/storaged/storage.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/configd/src/apps/sentinel/line-splitter.cpp b/configd/src/apps/sentinel/line-splitter.cpp index e52f4e3f33e..ec1fe41e766 100644 --- a/configd/src/apps/sentinel/line-splitter.cpp +++ b/configd/src/apps/sentinel/line-splitter.cpp @@ -88,7 +88,11 @@ LineSplitter::getLine() char *start = &_buffer[_readPos]; char *end = static_cast<char *>(memchr(start, '\n', bufLen)); if (_eof && !end) { - end = &_buffer[_writePos-1]; // pretend last byte sent was \n + if (_writePos < _size) { + end = &_buffer[_writePos]; // pretend last byte sent was followed by \n + } else { + end = &_buffer[_writePos-1]; // pretend last byte sent was \n + } } if (end) { *end = '\0'; diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index 8eb955ae930..1d84a73d1ed 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -129,9 +129,9 @@ namespace { if (sigtramp == 0) _exit(EXIT_FAILURE); // note: this is not totally safe, sigtramp is not protected by a lock sigtramp->handleSignal(sig); - } else { + } else if (_G_signalCount > 2) { fprintf(stderr, "Received another shutdown signal %u while " - "shutdown in progress (count=%u)", + "shutdown in progress (count=%u)\n", sig, _G_signalCount); } } |