[Mono-list] Async sockets and memory leaks in BeginSend
Nicholas Frechette
zeno490 at gmail.com
Mon May 28 14:21:54 UTC 2012
I would advise against a design relying on a crash callback to save data.
I do believe in mono (under linux only?) that you can hook into the
sigkill/sigterm or something similar. However, it probably isn't very
safe to do any amount of processing in those callbacks. I am also
pretty sure that it isn't supported under .net/windows.
Regardless, relying on such a callback isn't safe enough. In the event
where the hardware fails or power fails, your pc will shutdown and no
hardware failure callback will be called.
Even if there was, depending on which thread is executing that
callback and depending on the OS/mono behavior when that happens,
other threads might not get another chance to run, might have data
store in IO buffers or on the stack that you will not be able to find,
etc.
For sensitive data, either use a DB with transactions or roll out a
similar feature yourself: write everything to a journal/disk
periodically with an optional coalescing/compressing step that you
might run every day, twice a day, when a max size is reached, etc.
Other than that, you just have to accept that not all data can be
saved always :(
Cheers,
Nicholas
On Sat, May 26, 2012 at 5:52 PM, xplicit <svg at ngs.ru> wrote:
> I always run mono without --debug key, and memory is still leaking. I'll
> collect heapshot info of the my latest build and will post info from it in a
> day or two.
>
> There is much worse thing. After long working mono crashes with a dump. Once
> or twice it told, that could not create thread (it's predictable that in my
> app could be a sutiation, when max threads limit is reached, but why mono
> drops in core and did not call AppDomain.CurrentDomain.UnhandledException?)
> Sometimes it tells about segmentation fault (maybe this is related to high
> fragmentation in GC). Sometimes mono drops into core without any human
> readable cause. Several times I saw "timeout reached in the finalizer
> thread".
>
> I have got some important data in the memory, which I want to save on the
> crash of mono. Maybe mono has a some extension, which I can use to register
> 'on crash' callback and save important data?
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Async-sockets-and-memory-leaks-in-BeginSend-tp4648844p4649559.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list