Sunkwan-Kwon opened a new pull request #5627: [Issue 5626][pulsar-function-go] Fix a memory leak of pulsar-function-go library regarding time.NewTimer() URL: https://github.com/apache/pulsar/pull/5627 ### Motivation There is a memory leak in the pulsar-function-go library. It is related to KillAfterIdleMs configuration value. If I set the value to 0, time.NewTimer() function has occupied more memory indefinitely. Refer to the issue for more detail. (#5626) ### Modifications If `killAfterIdleMs` is 0, time.After() function call makes memory leak. Refer to https://golang.org/pkg/time/#After. According to the document, the underlying Timer object is not recovered by the garbage collector if the timer is not fired. And It seems that if the duration is 0, it will not be released. Therefore, use one Timer object for idle time checking explicitly instead of the time.After() function. ### Verifying this change Verified it by reproducing step described in the issue #5626. ### Does this pull request potentially affect one of the following parts: *If `yes` was chosen, please highlight the changes* - Dependencies (does it add or upgrade a dependency): (no) - The public API: (no) - The schema: (no) - The default values of configurations: (no) - The wire protocol: (no) - The rest endpoints: (no) - The admin cli options: (no) - Anything that affects deployment: (no) ### Documentation - Does this pull request introduce a new feature? (no)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
