Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] coio: fix cord leak on stop
@ 2020-09-22 14:59 Kirill Yukhin
  2020-09-22 15:10 ` Cyrill Gorcunov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kirill Yukhin @ 2020-09-22 14:59 UTC (permalink / raw)
  To: gorcunov; +Cc: tarantool-patches

cord_ptr variable is calloc()-ated in coio_on_start()
and is not free()-ed, which triggers ASAN. free() it
in coio_on_stop().

Closes #5308
---

Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-5308-cord-leak
Issue: https://github.com/tarantool/tarantool/issues/5308
ChangeLog: not user visible

 src/lib/core/coio_task.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/core/coio_task.c b/src/lib/core/coio_task.c
index 83f669d..c8be2de 100644
--- a/src/lib/core/coio_task.c
+++ b/src/lib/core/coio_task.c
@@ -123,6 +123,7 @@ coio_on_stop(void *data)
 {
 	(void) data;
 	cord_destroy(cord());
+	free(cord());
 	return 0;
 }
 
-- 
1.8.3.1

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

* Re: [Tarantool-patches] [PATCH] coio: fix cord leak on stop
  2020-09-22 14:59 [Tarantool-patches] [PATCH] coio: fix cord leak on stop Kirill Yukhin
@ 2020-09-22 15:10 ` Cyrill Gorcunov
  2020-09-23  5:18 ` Alexander V. Tikhonov
  2020-09-23 10:58 ` Kirill Yukhin
  2 siblings, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2020-09-22 15:10 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

On Tue, Sep 22, 2020 at 05:59:47PM +0300, Kirill Yukhin wrote:
> cord_ptr variable is calloc()-ated in coio_on_start()
> and is not free()-ed, which triggers ASAN. free() it
> in coio_on_stop().
> 
> Closes #5308
> ---
> 
> Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-5308-cord-leak
> Issue: https://github.com/tarantool/tarantool/issues/5308
> ChangeLog: not user visible
> 
>  src/lib/core/coio_task.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/lib/core/coio_task.c b/src/lib/core/coio_task.c
> index 83f669d..c8be2de 100644
> --- a/src/lib/core/coio_task.c
> +++ b/src/lib/core/coio_task.c
> @@ -123,6 +123,7 @@ coio_on_stop(void *data)
>  {
>  	(void) data;
>  	cord_destroy(cord());
> +	free(cord());
>  	return 0;
>  }

Ack.

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

* Re: [Tarantool-patches] [PATCH] coio: fix cord leak on stop
  2020-09-22 14:59 [Tarantool-patches] [PATCH] coio: fix cord leak on stop Kirill Yukhin
  2020-09-22 15:10 ` Cyrill Gorcunov
@ 2020-09-23  5:18 ` Alexander V. Tikhonov
  2020-09-23 10:58 ` Kirill Yukhin
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander V. Tikhonov @ 2020-09-23  5:18 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: tarantool-patches

Hi Kirill, thanks for the patch. I've checked it and seems that the
fixed lsan susspension can be removed, please use the following patch
before commit to releases:

diff --git a/asan/lsan.supp b/asan/lsan.supp
index 46b3001e9..f1ec60da3 100644
--- a/asan/lsan.supp
+++ b/asan/lsan.supp
@@ -43,8 +43,6 @@ leak:tt_bitset_iterator_init
 leak:libc.so*
 
 # test: box-tap/schema_mt.test.lua
-# source: src/lib/core/coio_task.c
-leak:coio_on_start
 # source: src/lib/salad/mhash.h
 leak:mh_i32ptr_new
 
Also the patch LGTM.

On Tue, Sep 22, 2020 at 05:59:47PM +0300, Kirill Yukhin wrote:
> cord_ptr variable is calloc()-ated in coio_on_start()
> and is not free()-ed, which triggers ASAN. free() it
> in coio_on_stop().
> 
> Closes #5308
> ---
> 
> Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-5308-cord-leak
> Issue: https://github.com/tarantool/tarantool/issues/5308
> ChangeLog: not user visible
> 
>  src/lib/core/coio_task.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/lib/core/coio_task.c b/src/lib/core/coio_task.c
> index 83f669d..c8be2de 100644
> --- a/src/lib/core/coio_task.c
> +++ b/src/lib/core/coio_task.c
> @@ -123,6 +123,7 @@ coio_on_stop(void *data)
>  {
>  	(void) data;
>  	cord_destroy(cord());
> +	free(cord());
>  	return 0;
>  }
>  
> -- 
> 1.8.3.1
> 

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

* Re: [Tarantool-patches] [PATCH] coio: fix cord leak on stop
  2020-09-22 14:59 [Tarantool-patches] [PATCH] coio: fix cord leak on stop Kirill Yukhin
  2020-09-22 15:10 ` Cyrill Gorcunov
  2020-09-23  5:18 ` Alexander V. Tikhonov
@ 2020-09-23 10:58 ` Kirill Yukhin
  2 siblings, 0 replies; 4+ messages in thread
From: Kirill Yukhin @ 2020-09-23 10:58 UTC (permalink / raw)
  To: gorcunov; +Cc: tarantool-patches

Hello,

On 22 сен 17:59, Kirill Yukhin wrote:
> cord_ptr variable is calloc()-ated in coio_on_start()
> and is not free()-ed, which triggers ASAN. free() it
> in coio_on_stop().
> 
> Closes #5308
> ---
> 
> Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-5308-cord-leak
> Issue: https://github.com/tarantool/tarantool/issues/5308
> ChangeLog: not user visible

I've checked the patch into 1.10, 2.4, 2.5 and master.
Applied update for supressions file as well.

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2020-09-23 10:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 14:59 [Tarantool-patches] [PATCH] coio: fix cord leak on stop Kirill Yukhin
2020-09-22 15:10 ` Cyrill Gorcunov
2020-09-23  5:18 ` Alexander V. Tikhonov
2020-09-23 10:58 ` Kirill Yukhin

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