Bug 29667 - Mono v4.0 crashes after a while
Summary: Mono v4.0 crashes after a while
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: General ()
Version: 4.0.0
Hardware: Macintosh Mac OS
: Normal major
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-05-01 16:18 UTC by henrik
Modified: 2015-05-11 04:37 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description henrik 2015-05-01 16:18:06 UTC
I'm running a F# web app with Logary and Suave and I just got a crash like this:

System.ArgumentException: Type MemoryCache cannot be marshaled as an unmanaged structure. Parameter name: t
  at at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:SizeOf (System.Type)
  at System.Runtime.Caching.SRef.get_ApproximateSize () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.Runtime.Caching/ReferenceSources/SRef.cs:21
  at System.Runtime.Caching.CacheMemoryMonitor.GetCurrentPressure () [0x00050] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/CacheMemoryMonitor.cs:155
  at System.Runtime.Caching.MemoryMonitor.Update () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/MemoryMonitor.cs:92
  at System.Runtime.Caching.MemoryCacheStatistics.Update () [0x0000b] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStatistics.cs:160
  at System.Runtime.Caching.MemoryCacheStatistics.CacheManagerThread (Int32 minPercent) [0x00028] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStatistics.cs:209
  at System.Runtime.Caching.MemoryCacheStatistics.CacheManagerTimerCallback (System.Object state) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStatistics.cs:83
  at System.Threading.Timer+Scheduler.TimerCB (System.Object o) [0x00007] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Threading/Timer.cs:327
Comment 3 henrik 2015-05-07 08:40:06 UTC
F#, OS X here.
Comment 4 henrik 2015-05-08 04:57:06 UTC
Another crash around MemoryCache that brings down the AppDomain + Process

10:48:22 web.1        | Unhandled Exception:
10:48:22 web.1        | System.ObjectDisposedException: The object was used after being disposed.
10:48:22 web.1        |   at System.Threading.WaitHandle.CheckDisposed () [0x00016] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Threading/WaitHandle.cs:426
10:48:22 web.1        |   at System.Threading.EventWaitHandle.Reset () [0x0000c] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Threading/EventWaitHandle.cs:196
10:48:22 web.1        |   at (wrapper remoting-invoke-with-check) System.Threading.EventWaitHandle:Reset ()
10:48:22 web.1        |   at System.Runtime.Caching.MemoryCacheStore.BlockInsert () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStore.cs:174
10:48:22 web.1        |   at System.Runtime.Caching.CacheEntryCollection.FlushItems (DateTime limit, CacheEntryRemovedReason reason, Boolean blockInsert, Int32 count) [0x00008] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.Runtime.Caching/ReferenceSources/CacheEntryCollection.cs:65
10:48:22 web.1        |   at System.Runtime.Caching.CacheExpires.FlushExpiredItems (Boolean blockInsert) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.Runtime.Caching/ReferenceSources/CacheExpires.cs:78
10:48:22 web.1        |   at System.Runtime.Caching.CacheExpires.<EnableExpirationTimer>m__0 (System.Object o) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System.Runtime.Caching/ReferenceSources/CacheExpires.cs:69
10:48:22 web.1        |   at System.Threading.Timer+Scheduler.TimerCB (System.Object o) [0x00007] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/corlib/System.Threading/Timer.cs:327
10:48:22 web.1        | exited with code 255
Comment 5 henrik 2015-05-08 05:03:49 UTC
Mono JIT compiler version 4.0.0 ((detached/d136b79 Mon Apr 13 14:40:59 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug
	LLVM:          yes(3.6.0svn-mono-(detached/a173357)
	GC:            sgen
Comment 6 brett.christensen 2015-05-08 20:34:59 UTC
I've had the same using the official docker mono 4.0 image
Comment 7 Marek Safar 2015-05-09 06:26:53 UTC
Fixed in master
Comment 8 Miguel de Icaza [MSFT] 2015-05-09 09:48:48 UTC
Guys, 

Could you apply this patch to your Mono 4.0.0 and try if this fixes the issue for you?

https://github.com/mono/mono/commit/ffb5c90e08d2f619b207c07c25b8551f52e9913e
Comment 9 Adi 2015-05-11 04:37:27 UTC
Solves the problem :)