From: Olga Arkhangelskaia <krishtal.olja@gmail.com>
To: tarantool-patches@freelists.org
Cc: Olga Arkhangelskaia <krishtal.olja@gmail.com>
Subject: [tarantool-patches] [PATCH v2] test: add test to check log_nonblock mode
Date: Tue, 14 Aug 2018 10:49:54 +0300 [thread overview]
Message-ID: <20180814074954.77928-1-krishtal.olja@gmail.com> (raw)
We should test log_nonblock mode. In some cases the loss of this flag
lead to tarantool hanging forever. This tests checks such possibility.
gh-3615 loss of nonblock flag in logger
---
https://github.com/tarantool/tarantool/issues/3615
https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-test-for-hanging-1.10
v1:
https://www.freelists.org/post/tarantool-patches/PATCH-boxtap-add-test-to-check-log-nonblock-mode
Changes in v2:
- now we fill socket with 1M of data
test/box-tap/cfg.test.lua | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua
index 45b645630..d31936d9a 100755
--- a/test/box-tap/cfg.test.lua
+++ b/test/box-tap/cfg.test.lua
@@ -6,7 +6,7 @@ local socket = require('socket')
local fio = require('fio')
local uuid = require('uuid')
local msgpack = require('msgpack')
-test:plan(95)
+test:plan(96)
--------------------------------------------------------------------------------
-- Invalid values
@@ -530,5 +530,28 @@ os.exit(res)
]]
test:is(run_script(code), 0, "remote syslog log configuration")
+--
+-- gh-3615: check that log_nonblock is not lost
+--
+code=[[
+local socket = require('socket')
+local log = require('log')
+local fio = require('fio')
+
+path = fio.pathjoin(fio.cwd(), 'log_unix_socket_test.sock')
+unix_socket = socket('AF_UNIX', 'SOCK_DGRAM', 0)
+unix_socket:bind('unix/', path)
+
+opt = string.format("syslog:server=unix:%s,identity=tarantool", path)
+box.cfg{log = opt, log_nonblock=true}
+-- Try to fill buffer
+for i = 1, 1000 do log.info(string.rep('x', 1000)) end
+
+unix_socket:close()
+os.remove(path)
+os.exit(0)
+]]
+test:is(run_script(code), 0, "log_nonblock")
+
test:check()
os.exit(0)
--
2.14.3 (Apple Git-98)
next reply other threads:[~2018-08-14 7:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-14 7:49 Olga Arkhangelskaia [this message]
2018-08-14 17:30 ` Vladimir Davydov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180814074954.77928-1-krishtal.olja@gmail.com \
--to=krishtal.olja@gmail.com \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH v2] test: add test to check log_nonblock mode' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox