Skip to content

Fix memory leak#22

Merged
vjt merged 1 commit intoifad:masterfrom
hectorj:fix-memory-leak
Jun 21, 2021
Merged

Fix memory leak#22
vjt merged 1 commit intoifad:masterfrom
hectorj:fix-memory-leak

Conversation

@hectorj
Copy link
Contributor

@hectorj hectorj commented May 4, 2021

Hi!

First, thank you for your work on clammit.

There is a small memory leak which starts to show when handling lots of requests. I found a corresponding issue in the go-clamd library used: dutchcoders/go-clamd#9

Here is a small patch to fix it. I tried it and it did stabilize memory usage.

@vjt
Copy link
Contributor

vjt commented May 4, 2021

LGTM, thank you.

@jblackman cleared for merge?

May the 4th be with you! :-)

@hectorj
Copy link
Contributor Author

hectorj commented May 4, 2021

To be complete, here is the pprof heap flamegraph I get after a large amount of requests (before this PR):

clammit_flamegraph

@jblackman
Copy link
Contributor

The loop to suck the chan dry seems a bit hacky to me. It would be better to address this in go-clamd itself, IMO, but if you are pressed for time, then all good.

@hectorj
Copy link
Contributor Author

hectorj commented May 6, 2021

The loop to suck the chan dry seems a bit hacky to me. It would be better to address this in go-clamd itself, IMO, but if you are pressed for time, then all good.

Agreed, it is a quickfix (I'm worried go-clamd is not maintained anymore, though I can still try a PR)

@Helios-23
Copy link

When is this memory leak fix going to be rolled into the main/release?

@vjt vjt mentioned this pull request May 25, 2021
@vjt
Copy link
Contributor

vjt commented May 25, 2021

When is this memory leak fix going to be rolled into the main/release?

Hello,

I prefer to fix this in go-clamd, please hold until the end of this week, I'll update this issue by then.

@vjt
Copy link
Contributor

vjt commented Jun 21, 2021

Dear @hectorj thanks for your contribution. As I wasn't able to focus on this, I've merged your fix and released v0.7.3. I anyway leave #27 open to proper fix this in go-clamd.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants