-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observed Memory Leak in WCF #10
Comments
Yes please let us know your version of .net, log4net, and paste your config. Also what activities trigger the leak and how long does it take? |
.Net 4.5.2 <?xml version="1.0" encoding="utf-8" ?>
<log4net>
<logger name="myLogger">
<level value="ERROR"/>
<appender-ref ref="RollingBySize" />
<appender-ref ref="LogglyAppender"/>
</logger>
<appender name="RollingBySize" type="log4net.Appender.RollingFileAppender">
<file value="logs\webService.log" />
<PreserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %x %logger - %message%newline" />
</layout>
</appender>
<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level - %message%newline" />
</layout>
</appender>
<appender name="LogglyAppender" type="log4net.loggly.LogglyAppender, log4net-loggly">
<rootUrl value="https://logs-01.loggly.com/" />
<inputKey value="TOKEN" />
<tag value="log4net" />
</appender>
</log4net> |
Ok and you're on version 7.3.0 of log4net-loggly?
https://www.nuget.org/packages/log4net-loggly/
Thanks,
Jason
…On Mon, Jun 19, 2017 at 1:04 PM, Zachery Bohon ***@***.***> wrote:
.Net 4.5.2
Log4net version 1.2.15.0
We've tried rebuilding the log4net-loggly project with the newer version
of log4net but the issue still seems to come up. It seem like every time
our WCF service calls GetLogger it is instantiating a new instance of the
LogglyAppender class.
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
<logger name="myLogger">
<level value="ERROR"/>
<appender-ref ref="RollingBySize" />
<appender-ref ref="LogglyAppender"/>
</logger>
<appender name="RollingBySize" type="log4net.Appender.RollingFileAppender">
<file value="logs\webService.log" />
<PreserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %-5level %x %logger - %message%newline" />
</layout>
</appender>
<appender name="DebugAppender" type="log4net.Appender.DebugAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level - %message%newline" />
</layout>
</appender>
<appender name="LogglyAppender" type="log4net.loggly.LogglyAppender, log4net-loggly">
<rootUrl value="https://logs-01.loggly.com/" />
<inputKey value="TOKEN" />
<tag value="log4net" />
</appender>
</log4net>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYe-H6qkw2p_8fvDu1-k_jMY9PVAunXYks5sFtRngaJpZM4N7ZG_>
.
|
I am using the latest code from this Git repo. |
Okay thanks for giving us the information! I think we have what we need. Our developer is currently working on some other tasks and will hopefully be able to work on it sometime this quarter. If you figure it out before us, please feel free to submit your findings or even a pull request. |
I am running same versions and configurations as above and have memory leak in Windows Service. Since this post is from 2017, I am going to assume that Loggly does not want to fix this and I will need to find a better logging resource. |
Hi @YouGitMoreWithLes, Sorry for the delay here. This issue was on priority in our list but unfortunately, got skipped due to other tasks. Please give me some time to look into this and I'll try to come up with some solution soon. Thank you for your patience. |
Sounds good. Thanks.
…On Tue, Jul 24, 2018, 7:15 AM Shwetajain148 ***@***.***> wrote:
Hi @YouGitMoreWithLes <https://github.com/YouGitMoreWithLes>, Sorry for
the delay here. This issue was on priority in our list but unfortunately,
got skipped due to other tasks. Please give me some time to look into this
and I'll try to come up with some solution soon.
Thank you for your patience.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AK4fDp-BtojIq9rfBBEHMVmzFsMtstLLks5uJw_2gaJpZM4N7ZG_>
.
|
@YouGitMoreWithLes , @zacherybohon Hello, I'm looking into this and it would help if you can provide a sample code that causes memory leak in your application. The only scenario where I'm able to see the memory usage increase is if I log faster than it's able to send logs to Loggly. In that case the logs are queued to be sent to Loggly and this queue can grow indefinitely if the income is still faster than sending. Could that be your case? If so, would you prefer to have an option to limit this queue size and lose some logs if the queue gets full? |
@Katulus : Thank you for your response/investigation. Please see my original post here, which contains our sample config file. In our code, we instantiate one logger per service file, as shown in the example below: A search of our code shows that we have 79 such invocations, which seems reasonable. It's hard to say whether or not we're logging too prodigiously for the logger to keep up because I don't know what the "problem" threshold is. But between 15 Dec and 17 Dec 2018 on one of our highly trafficked systems, we logged 6.3K individual entries straight to a local log file via log4net (not to loggly). If we hadn't disabled the loggly appender to resolve the memory leak, the numbers would have been the same. In looking over the notes from my investigation almost two years ago, I was convinced that a new LogglyAppender was always being instantiated with each new
@zacherybohon also found that log4net-loggly "is creating a new instance of the logglyAppender object for each call", but he was unable to catch/see the cast exception that I pasted above. He suspected "that the logglyAppender is not being disposed of when it goes out of scope". But I believe that after additional investigation he thought that log4net-loggly was "not correctly disposing of the timer for the batches." Thanks for any assistance/insight you can provide! |
@loweva , thanks for the details. 6.3k events per 2 days should be far below safe threshold. When I was talking about fast logging I meant thousands of events per minute. Looking at your The instance of Same applies to disposing, it's If you are on latest version, using |
@loweva , new version (beta) has been just released. You can get it on https://github.com/loggly/log4net-loggly/releases/tag/v9.0.0-beta1 or via Nuget. It's almost complete rewrite of the library and none of tests we ran showed any memory issues. Can you give it a try and let us know if the issue is gone or if you still see memory leaks? |
@Katulus : We have tried again with the new version, and we see no evidence of memory leaks! Thank you! |
Thanks for confirmation. Closing the issue. |
When we include the loggly-log4net's logglyAppender in our log4net config, it results in a memory leak. Removing it resolves the leak. Please let me know if you need any additional information to investigate this issue.
The text was updated successfully, but these errors were encountered: