Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode
@ 2018-08-13  7:12 Olga Arkhangelskaia
  2018-08-13 10:20 ` Vladimir Davydov
  0 siblings, 1 reply; 3+ messages in thread
From: Olga Arkhangelskaia @ 2018-08-13  7:12 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Olga Arkhangelskaia

We should test log_nonblock mode. In some cases the loss of this flag
leads to tarantool hanging forever (centos/fedora 26/27).
This tests checks such possibility.

Closes #3615
---
https://github.com/tarantool/tarantool/issues/3615
https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-test-for-hanging-1.10

 test/box-tap/cfg.test.lua | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua
index 45b645630..0d2133bee 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,38 @@ os.exit(res)
 ]]
 test:is(run_script(code), 0, "remote syslog log configuration")
 
+--
+-- Check nonblock mode
+--
+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)
+local res = 1
+local buf = 'Started\n'
+box.cfg{log = opt, log_nonblock=true}
+-- Try to fill socket buffer
+a = 0
+while a < 10 do
+    a = a + 1
+    log.info('Test nonblock')
+end
+while unix_socket:readable(0.001) do
+    buf = buf .. unix_socket:recv(1000)
+    if buf:match('Test nonblock') then res = 0 end
+end
+
+unix_socket:close()
+os.remove(path)
+os.exit(res)
+]]
+test:is(run_script(code), 0, "log_nonblock")
+
 test:check()
 os.exit(0)
-- 
2.14.3 (Apple Git-98)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode
  2018-08-13  7:12 [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode Olga Arkhangelskaia
@ 2018-08-13 10:20 ` Vladimir Davydov
       [not found]   ` <CAG9q7EpeeZqcqAFb9Og6koC1pMHVdD6jiV3vG7g=Oss82YcE3A@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Davydov @ 2018-08-13 10:20 UTC (permalink / raw)
  To: Olga Arkhangelskaia; +Cc: tarantool-patches

On Mon, Aug 13, 2018 at 10:12:08AM +0300, Olga Arkhangelskaia wrote:
> We should test log_nonblock mode. In some cases the loss of this flag
> leads to tarantool hanging forever (centos/fedora 26/27).
> This tests checks such possibility.
> 
> Closes #3615
> ---
> https://github.com/tarantool/tarantool/issues/3615
> https://github.com/tarantool/tarantool/tree/OKriw/gh-3615-test-for-hanging-1.10

The test passes even without the patch that fixes log_nonblock behavior.
Please make sure it doesn't.

Also 'box-tap' is a wrong prefix. The subsystem you're patching is
called 'test'. Please fix.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode
       [not found]   ` <CAG9q7EpeeZqcqAFb9Og6koC1pMHVdD6jiV3vG7g=Oss82YcE3A@mail.gmail.com>
@ 2018-08-13 12:01     ` Vladimir Davydov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Davydov @ 2018-08-13 12:01 UTC (permalink / raw)
  To: Olga Krishtal; +Cc: tarantool-patches

Please don't drop tarantool-patches@freelists.org from Cc.

On Mon, Aug 13, 2018 at 02:50:02PM +0300, Olga Krishtal wrote:
> Sorry, I sent wrong patch. I see it now.
> However, I do face some problem - I can't reproduce test on my mac. On
> centos -it is OK, however, mac - no.
> I am not sure what to do.

Simply write 1 MB to the socket, and it will hang on most Linux
distributions:

for i = 1, 1000 do log.info(string.rep('x', 1000)) end

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-13 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13  7:12 [tarantool-patches] [PATCH] box-tap: add test to check log_nonblock mode Olga Arkhangelskaia
2018-08-13 10:20 ` Vladimir Davydov
     [not found]   ` <CAG9q7EpeeZqcqAFb9Og6koC1pMHVdD6jiV3vG7g=Oss82YcE3A@mail.gmail.com>
2018-08-13 12:01     ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox