# Is there a goroutine leak in libbeat?

**URL:** <https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [June 12, 2020, 5:59am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822 "2020-06-12T05:59:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![erenming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erenming/32/90751_2.png) [@erenming](https://discuss.elastic.co/u/erenming)\
**Post date:** [June 12, 2020, 5:59am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822/1 "2020-06-12T05:59:38Z")

</div>

I'm doing a pressure test for our beats like filebeat use libbeat package，But I found `github.com/elastic/beats/libbeat/reader/readfile.(*TimeoutReader).Next.func1` is continuous growing。

The presure test condition is described as follows：

1. i generate 100 file concurrently
2. and generate log line without sleep for about five seconds
3. limit the container with 0.2 cpus, 512Mi.

this is memory and cpu utilization:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b6fa0fcd0bddca7e76274664d4fe2e8082456ccf.png)

and this is the goroutine compares, and the duration is about 30minutes.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/2/d2bdc70d6ae965735f84625addafd8fb198945b7.png)

and the version of libbeat is v7.6.2

anyone could help me? thanks

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [June 12, 2020, 7:47am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822/2 "2020-06-12T07:47:08Z")

</div>

Hi!

It seems that the memory is constantly going up, which could be a bad indicator indeed.  
From what I understand from your test there are logs coming only for the first 5 seconds and then nothing? Or you are constantly adding batches of 100 files with a specific rate?

cc: @kvch

---

<div class="post-metadata">

**Author:** ![erenming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erenming/32/90751_2.png) [@erenming](https://discuss.elastic.co/u/erenming)\
**Post date:** [June 12, 2020, 8:31am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822/3 "2020-06-12T08:31:33Z")

</div>

Thanks for your reply!  
This is my pressure test procedure.  
First, i create 100 files, and then add about 5000 lines to each file in 5 seconds。

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [June 15, 2020, 7:21am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822/4 "2020-06-15T07:21:11Z")

</div>

Hi @erenming!

I suggest you opening a Github issue to report this observation since it sounds valid enough. Could you please open a Github issue in order to keep track of this please? Provide all the information you posted here as well as possible steps to reproduce.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 13, 2020, 9:21am UTC](https://discuss.elastic.co/t/is-there-a-goroutine-leak-in-libbeat/236822/5 "2020-07-13T09:21:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
