Looks good for me, thanks On Saturday, February 23, 2019 4:34:42 PM MSK Cyrill Gorcunov wrote: > If I create a new fiber and the join to himself we get an abort: > | tarantool> f = require('fiber') > | --- > | ... > | > | tarantool> f.join(f.self()) > | tarantool: src/fiber.c:407: fiber_join: Assertion `fiber->flags & > | FIBER_IS_JOINABLE' failed. Aborted (core dumped) > > we should better throw an error. > > v2: by georgy@ > - add a testcase > > Signed-off-by: Cyrill Gorcunov > --- > src/lua/fiber.c | 6 +++++- > test/app/fiber.result | 11 +++++++++++ > test/app/fiber.test.lua | 7 +++++++ > 3 files changed, 23 insertions(+), 1 deletion(-) > > Index: tarantool.git/src/lua/fiber.c > =================================================================== > --- tarantool.git.orig/src/lua/fiber.c > +++ tarantool.git/src/lua/fiber.c > @@ -676,10 +676,14 @@ lbox_fiber_join(struct lua_State *L) > { > struct fiber *fiber = lbox_checkfiber(L, 1); > struct lua_State *child_L = fiber->storage.lua.stack; > - fiber_join(fiber); > struct error *e = NULL; > int num_ret = 0; > int coro_ref = 0; > + > + if (!(fiber->flags & FIBER_IS_JOINABLE)) > + luaL_error(L, "the fiber is not joinable"); > + fiber_join(fiber); > + > if (child_L != NULL) { > coro_ref = lua_tointeger(child_L, -1); > lua_pop(child_L, 1); > Index: tarantool.git/test/app/fiber.result > =================================================================== > --- tarantool.git.orig/test/app/fiber.result > +++ tarantool.git/test/app/fiber.result > @@ -1454,6 +1454,17 @@ ch1:put(1) > while f:status() ~= 'dead' do fiber.sleep(0.01) end > --- > ... > +-- > +-- Test if fiber join() does not crash > +-- if unjoinable > +-- > +fj = require('fiber') > +--- > +... > +fj.join(fj.self()) > +--- > +- error: the fiber is not joinable > +... > -- cleanup > test_run:cmd("clear filter") > --- > Index: tarantool.git/test/app/fiber.test.lua > =================================================================== > --- tarantool.git.orig/test/app/fiber.test.lua > +++ tarantool.git/test/app/fiber.test.lua > @@ -623,6 +623,13 @@ ch1:put(1) > > while f:status() ~= 'dead' do fiber.sleep(0.01) end > > +-- > +-- Test if fiber join() does not crash > +-- if unjoinable > +-- > +fj = require('fiber') > +fj.join(fj.self()) > + > -- cleanup > test_run:cmd("clear filter")