Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Maksim Kokryashkin <max.kokryashkin@gmail.com>,
	tarantool-patches@dev.tarantool.org, skaplun@tarantool.org,
	m.kokryashkin@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v2] test: fix flaky OOM error frame test
Date: Sat, 18 Nov 2023 19:52:53 +0300	[thread overview]
Message-ID: <1e374d3c-ad4a-4379-a22b-85cbc083f658@tarantool.org> (raw)
In-Reply-To: <20231109134549.4905-1-max.kokryashkin@gmail.com>

Hello, Max

LGTM with a question below


On 11/9/23 16:45, Maksim Kokryashkin wrote:
> This test could do allocation outside of the protected frame,
> which could result in an uncaught OOM and test failure. This
> patch adds extra `collectgarbage` calls to the test to avoid
> such situations.
> ---
> Changes in v2:
> - Fixed comments as per review by Sergey Kaplun
> Branch: https://github.com/tarantool/luajit/tree/fckxorg/lj-1004-fix-flaky
> PR: https://github.com/tarantool/tarantool/pull/9318
>   test/tarantool-tests/lj-1004-oom-error-frame.test.lua | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/test/tarantool-tests/lj-1004-oom-error-frame.test.lua b/test/tarantool-tests/lj-1004-oom-error-frame.test.lua
> index 3be6b555..2ddb5765 100644
> --- a/test/tarantool-tests/lj-1004-oom-error-frame.test.lua
> +++ b/test/tarantool-tests/lj-1004-oom-error-frame.test.lua
> @@ -10,6 +10,8 @@ test:plan(2)
>
>   local testoomframe = require('testoomframe')
>
> +collectgarbage()

Probably it is obvious, but I don't get it.

Usually for forcing garbage collecting one need call `collectgarbage()` 
two times:

for mark and sweep. You call it single time, why?


> +
>   local anchor_memory = {} -- luacheck: no unused
>   local function eatchunks(size)
>     while true do
> @@ -34,6 +36,11 @@ local function chomp()
>   end
>
>   local st, err = pcall(chomp)
> +
> +-- Prevent OOM outside of the protected frame.
> +anchor_memory = nil
> +collectgarbage()
Ditto.
> +
>   test:ok(st == false, 'on-trace error handled successfully')
>   test:like(err, 'not enough memory', 'error is OOM')
>   test:done(true)
> --
> 2.39.3 (Apple Git-145)
>

  parent reply	other threads:[~2023-11-18 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 13:45 Maksim Kokryashkin via Tarantool-patches
2023-11-13  6:58 ` Sergey Kaplun via Tarantool-patches
2023-11-18 16:52 ` Sergey Bronnikov via Tarantool-patches [this message]
2023-11-18 17:55   ` Sergey Bronnikov via Tarantool-patches
2023-11-19 11:49   ` Maxim Kokryashkin via Tarantool-patches
2023-11-20 14:53   ` Igor Munkin via Tarantool-patches
2023-11-22 15:28     ` Sergey Bronnikov via Tarantool-patches
2023-11-22 15:30     ` Sergey Bronnikov via Tarantool-patches
2023-11-23  6:32 ` Igor Munkin via Tarantool-patches

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=1e374d3c-ad4a-4379-a22b-85cbc083f658@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v2] test: fix flaky OOM error frame test' \
    /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