diff --git a/src/coeio.cc b/src/coeio.cc index cc01d906373394910d9d3a8ee6a0fd10b4530651..3490dba7be531d8ebc913cf005124a0bf9f9f949 100644 --- a/src/coeio.cc +++ b/src/coeio.cc @@ -170,10 +170,11 @@ coio_task(struct coio_task *task, coio_task_cb func, task->complete = 0; eio_submit(&task->base); - - if (fiber_yield_timeout(timeout) && !task->complete) { - /* timed out. */ + fiber_yield_timeout(timeout); + if (!task->complete) { + /* timed out or cancelled. */ task->fiber = NULL; + fiber_testcancel(); tnt_raise(TimedOut); } diff --git a/test/app/cfg.test.lua b/test/app/cfg.test.lua index a5c2a80d1c86b5f552444bb7af1f8a7b3162472e..6a549dca5d0f901c6cacefe03760cf52cdd18305 100755 --- a/test/app/cfg.test.lua +++ b/test/app/cfg.test.lua @@ -80,6 +80,13 @@ test:is(box.cfg.too_long_threshold, 0.5, "too_long_threshold default value") box.cfg{too_long_threshold=0.1} test:is(box.cfg.too_long_threshold , 0.1, "too_long_threshold new value") +-------------------------------------------------------------------------------- +-- gh-537: segmentation fault with replication_source +-------------------------------------------------------------------------------- + +box.cfg{replication_source = 'guest:password@localhost:0'} +box.cfg{replication_source = ""} + local tarantool_bin = arg[-1] local PANIC = 256 function run_script(code) diff --git a/test/box/bsdsocket.result b/test/box/bsdsocket.result index 763617fe2aaa50b07b4e41746090e4f0e013933b..ca574d3332102b11581729e398081def09aacfb3 100644 --- a/test/box/bsdsocket.result +++ b/test/box/bsdsocket.result @@ -1526,3 +1526,16 @@ socket.getaddrinfo('host', 'port', { flags = 'WRONG' }) == nil and errno() == er --- - true ... +-- gh-574: check that fiber with getaddrinfo can be safely cancelled +--# setopt delimiter ';' +f = fiber.create(function() + while true do + local result = socket.getaddrinfo('localhost', '80') + end +end); +--- +... +--# setopt delimiter '' +f:cancel() +--- +... diff --git a/test/box/bsdsocket.test.lua b/test/box/bsdsocket.test.lua index 0a8da452f234b4e74818221b9cadab5c752b4749..871e04785cf53db0184d0d45e3707d2ec0bc77bf 100644 --- a/test/box/bsdsocket.test.lua +++ b/test/box/bsdsocket.test.lua @@ -523,3 +523,13 @@ socket.getaddrinfo('host', 'port', { type = 'WRONG' }) == nil and errno() == err socket.getaddrinfo('host', 'port', { family = 'WRONG' }) == nil and errno() == errno.EINVAL socket.getaddrinfo('host', 'port', { protocol = 'WRONG' }) == nil and errno() == errno.EINVAL socket.getaddrinfo('host', 'port', { flags = 'WRONG' }) == nil and errno() == errno.EINVAL + +-- gh-574: check that fiber with getaddrinfo can be safely cancelled +--# setopt delimiter ';' +f = fiber.create(function() + while true do + local result = socket.getaddrinfo('localhost', '80') + end +end); +--# setopt delimiter '' +f:cancel()