Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function
@ 2022-02-28 23:54 Maxim Kokryashkin via Tarantool-patches
  2022-03-02  5:59 ` Sergey Kaplun via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2022-02-28 23:54 UTC (permalink / raw)
  To: tarantool-patches, imun, skaplun

The first fiber in Tarantool has only 512Kb of the stack, which is not enough
to handle such a deep call chain. Thus, the chunk of code being considered
cores with SIGSEGV as a result of C stack overflow.
The test is adapted to Tarantool by decreasing the string length.

Resolves tarantool/tarantool#5782
Part of tarantool/tarantool#5870
---
Changes in v2:
- Fixed comments as per review by Igor

GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5782-adapt-deep-nest-gsub-PUC-Rio
CI branch: https://github.com/tarantool/tarantool/tree/fckxorg/gh-5782-adapt-test-checking-reversed-function-full-ci
Issue: https://github.com/tarantool/tarantool/issues/5782

 test/PUC-Rio-Lua-5.1-tests/pm.lua | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/PUC-Rio-Lua-5.1-tests/pm.lua b/test/PUC-Rio-Lua-5.1-tests/pm.lua
index e364ff9d..61f437f6 100644
--- a/test/PUC-Rio-Lua-5.1-tests/pm.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/pm.lua
@@ -206,12 +206,16 @@ function rev (s)
   return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end)
 end
 
-local x = string.rep('012345', 10)
--- FIXME: The first Tarantool's fiber has only 512Kb of stack.
--- It is not enough for this recursive call.
+-- The first fiber in Tarantool has only 512Kb of the stack,
+-- which is not enough to handle such a deep call chain. Thus,
+-- the chunk of code being considered cores with SIGSEGV as a
+-- result of C stack overflow.
+--
+-- This test is adapted to match the stack size of the first fiber in
+-- Tarantool by decreasing the string length.
 -- See also https://github.com/tarantool/tarantool/issues/5782.
--- The test is disabled for Tarantool binary.
--- assert(rev(rev(x)) == x)
+local x = string.rep('01234', 10)
+assert(rev(rev(x)) == x)
 
 
 -- gsub with tables
-- 
2.35.1


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

* Re: [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function
  2022-02-28 23:54 [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function Maxim Kokryashkin via Tarantool-patches
@ 2022-03-02  5:59 ` Sergey Kaplun via Tarantool-patches
  2022-06-01 14:31 ` Igor Munkin via Tarantool-patches
  2022-06-20 12:47 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2022-03-02  5:59 UTC (permalink / raw)
  To: Maxim Kokryashkin; +Cc: tarantool-patches

Hi, Maxim!

Thanks for the fixes!

LGTM.

On 01.03.22, Maxim Kokryashkin wrote:

<snipped>

> diff --git a/test/PUC-Rio-Lua-5.1-tests/pm.lua b/test/PUC-Rio-Lua-5.1-tests/pm.lua
> index e364ff9d..61f437f6 100644
> --- a/test/PUC-Rio-Lua-5.1-tests/pm.lua
> +++ b/test/PUC-Rio-Lua-5.1-tests/pm.lua
> @@ -206,12 +206,16 @@ function rev (s)
>    return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end)
>  end
>  
> -local x = string.rep('012345', 10)
> --- FIXME: The first Tarantool's fiber has only 512Kb of stack.
> --- It is not enough for this recursive call.
> +-- The first fiber in Tarantool has only 512Kb of the stack,
> +-- which is not enough to handle such a deep call chain. Thus,
> +-- the chunk of code being considered cores with SIGSEGV as a
> +-- result of C stack overflow.
> +--
> +-- This test is adapted to match the stack size of the first fiber in
> +-- Tarantool by decreasing the string length.
>  -- See also https://github.com/tarantool/tarantool/issues/5782.
> --- The test is disabled for Tarantool binary.
> --- assert(rev(rev(x)) == x)

Minor: Please, add the comment, that the following example crashes both
Tarantool and LuaJIT (so the problem with C stack overflow still
exists):

| luajit -e '
| local function rev (s)
|   return string.gsub(s, "(.)(.+)", function (c,s1)
|     return rev(s1)..c
|   end)
| end
| local x = string.rep("0", 1000)
| rev(x)
| '

> +local x = string.rep('01234', 10)
> +assert(rev(rev(x)) == x)
>  
>  
>  -- gsub with tables
> -- 
> 2.35.1
> 

-- 
Best regards,
Sergey Kaplun

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

* Re: [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function
  2022-02-28 23:54 [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function Maxim Kokryashkin via Tarantool-patches
  2022-03-02  5:59 ` Sergey Kaplun via Tarantool-patches
@ 2022-06-01 14:31 ` Igor Munkin via Tarantool-patches
  2022-06-20 12:47 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2022-06-01 14:31 UTC (permalink / raw)
  To: Maxim Kokryashkin; +Cc: tarantool-patches

Max,

Thanks for the fixes! LGTM.

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function
  2022-02-28 23:54 [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function Maxim Kokryashkin via Tarantool-patches
  2022-03-02  5:59 ` Sergey Kaplun via Tarantool-patches
  2022-06-01 14:31 ` Igor Munkin via Tarantool-patches
@ 2022-06-20 12:47 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2022-06-20 12:47 UTC (permalink / raw)
  To: Maxim Kokryashkin; +Cc: tarantool-patches

Max,

I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in master, 2.10 and 1.10.

On 01.03.22, Maxim Kokryashkin wrote:
> The first fiber in Tarantool has only 512Kb of the stack, which is not enough
> to handle such a deep call chain. Thus, the chunk of code being considered
> cores with SIGSEGV as a result of C stack overflow.
> The test is adapted to Tarantool by decreasing the string length.
> 
> Resolves tarantool/tarantool#5782
> Part of tarantool/tarantool#5870
> ---
> Changes in v2:
> - Fixed comments as per review by Igor
> 
> GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5782-adapt-deep-nest-gsub-PUC-Rio
> CI branch: https://github.com/tarantool/tarantool/tree/fckxorg/gh-5782-adapt-test-checking-reversed-function-full-ci
> Issue: https://github.com/tarantool/tarantool/issues/5782
> 
>  test/PUC-Rio-Lua-5.1-tests/pm.lua | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 

<snipped>

> -- 
> 2.35.1
> 

-- 
Best regards,
IM

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

end of thread, other threads:[~2022-06-20 12:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 23:54 [Tarantool-patches] [PATCH luajit v2] test: adapt test checking reversed function Maxim Kokryashkin via Tarantool-patches
2022-03-02  5:59 ` Sergey Kaplun via Tarantool-patches
2022-06-01 14:31 ` Igor Munkin via Tarantool-patches
2022-06-20 12:47 ` Igor Munkin via Tarantool-patches

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