protoactor-go icon indicating copy to clipboard operation
protoactor-go copied to clipboard

Potential memory leak

Open xiaoqinguo opened this issue 3 years ago • 5 comments

child_restart_stats.go if not reached the condition to reset, the length of failureTimes will keep growing

9xE2MvlZBa

xiaoqinguo avatar Aug 22 '22 11:08 xiaoqinguo

I am not sure what is what you mean but is not even possible that there is a memory leak in the piece of code that you just pasted, this is a simple loop, even if the condition was never reach the only thing that would happen to num is that it would overflow, and if that ever happened, you have bigger problems as this would dead lock forever

DamnWidget avatar Aug 22 '22 11:08 DamnWidget

maybe I should pasted this piece of code. if condition is never reached, the reset will never be called. but the function rs.Fail lead the growth of rs.failureTimes.

XshEHxiM64

xiaoqinguo avatar Aug 22 '22 12:08 xiaoqinguo

It's my advice.

vQJYNviGaf

xiaoqinguo avatar Aug 22 '22 12:08 xiaoqinguo

I'm from China and my English is not very well. Thanks for your attention.

xiaoqinguo avatar Aug 22 '22 12:08 xiaoqinguo

I am not sure what is what you mean but is not even possible that there is a memory leak in the piece of code that you just pasted, this is a simple loop, even if the condition was never reach the only thing that would happen to num is that it would overflow, and if that ever happened, you have bigger problems as this would dead lock forever

Can you see my reply?

xiaoqinguo avatar Aug 22 '22 12:08 xiaoqinguo

@xiaoqinguo Hello. You mean Fail or NumberOfFailures will causing memory leak? Maybe a Example to reproduce it will be clearly. 😃 https://github.com/asynkron/protoactor-go/blob/d2ceff064d72ca58a9365439827375024ba69c85/actor/child_restart_stats.go#L33-L48

https://github.com/asynkron/protoactor-go/blob/d2ceff064d72ca58a9365439827375024ba69c85/actor/child_restart_stats.go#L23-L25

cupen avatar Sep 23 '22 05:09 cupen

@cupen 上次是把代码全部看了一遍,这个问题确实是看代码发现的问题,不过问题并不大,也不一定能测出来,但逻辑上看确实会存在泄露

xiaoqinguo avatar Oct 12 '22 06:10 xiaoqinguo