-
Notifications
You must be signed in to change notification settings - Fork 60
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
ObjectDisposedException crashes out App Pool when used in ASP.NET #18
Comments
Hi I've been trying to reproduce the error in a Simple Console Application creating tasks and cancelling the tasks even I try to call the base method
Changing the size of the MaxChunkSize message thinking that it was maybe the method that create the part of the messages. I checked the base class of I also tried to stop graylog in the middle of logging and started up And I couldn't reproduce the exception ObjectDisposedException This is the documentation of the exception in MSDN https://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.endreceive%28v=vs.110%29.aspx
I'm sure that in the code the socket is never closed in I created too a MVC project and added Can you reproduce the exception in local? |
Yeah I haven't been able to reproduce it locally either. I'm thinking maybe it's an issue with the Amazon Hosting Environment. Some sort of network error that cuts the connection, leaving it in a state like that. I'm thinking though, that it's kinda nasty that the App Pool can be killed in case of something like that (if that is indeed the issue). Handling the exception and attempting recreate the connection might be a good idea? I don't mind trying to make a pull request that attempts something like that. |
Hi! Sure handling the exception and recreating the connection could be a good idea to avoid the crash in the AppPool but I'm not sure how will it behave with multiple threads, should we I'll be glad with your PR that can handle that sort of exception and keep the integrity of the messages. Maybe another option more suited in the Amazon Hosting Environment could be to use the By the way. I haven't tested |
Another thing just to know if it's the environment we can override something like this protected override void OnClose()
{
base.OnClose();
string sSource;
string sLog;
string sEvent;
sSource = "gelf4net";
sLog = "Application";
sEvent = "Closing event";
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, sEvent);
EventLog.WriteEntry(sSource, sEvent,
EventLogEntryType.Warning, 234);
} |
Hey! Sorry about the late response! I just looked over more of our code, and it seems that Could that cause the socket to be closed and reopen, causing the ObjectDisposedException to occur? |
Hi! Yup, that's the cause of the exception. I ran some tests calling Ok, I'll close the issue, thanks for the info :) |
Hey all. I'm a bit confused if there is an actual resolution to this issue, or we should change the way we use log4net (call log first before Configure?). We are running into the same issue, as intermittently our console app that logs to graylog crashes with the same message in the EventLog as OP. Thanks! |
No, the original issue was that every time when The way it should be done is to call just once when the application start |
Thanks. So is there a workaround of any sort? |
Yes, the library works, Do you have a project to reproduce the exception, so I can help you...... |
Hello and greetings!
I'm using gelf4net in an ASP.NET MVC application, hosted on AWS Elastic Beanstalk.
The App Pool crashes out almost immediately after the application starts running, with the following exception in the Windows Event Log:
I'm fairly confident that the exception occurs on this line: https://github.com/jjchiw/gelf4net/blob/master/src/Gelf4net/Appender/GelfUdpAppender.cs#L100
I'm wondering why the exception occurs though, since if it was a network connection loss I'd not expect an ObjectDisposedException.
Edit: After having consulted MSDN, it seems this exception gets thrown when the connection is closed.
Since this exception occurs in a thread not directly managed by IIS, it crashes out the worker process, sending the server into a permanent 503 state, until it's restarted by some means.
This is my configuration:
I call
log4net.Config.XmlConfigurator.Configure();
once in Application_Start(), and then use the logger like this:The logging works - I'm getting messages in greylog up to the point where it crashes out. Any input?
The text was updated successfully, but these errors were encountered: