Bug 36732 - Attempting to JIT compile method while running with --aot-only
Summary: Attempting to JIT compile method while running with --aot-only
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler ()
Version: XI 9.0 (iOS9)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-12-08 22:15 UTC by Todd Diehl
Modified: 2016-04-12 15:43 UTC (History)
3 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 Developer Community or GitHub 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 NORESPONSE

Description Todd Diehl 2015-12-08 22:15:47 UTC
We are getting an error related to attempting to JIT compile a method when running with --aot-only, however, it is happening randomly.  We get reports of the error via Raygun from an AppStore deployed build.  We have not been able to observe the issue in a simulator, or replicate when testing on device.  We've seen it happen in a couple of code scenarios, I can share the outline of one below.

In this case, we are registering a managed type with the Objective-C runtime.  We receive the error: "Attempting to JIT compile method 'Faithlife.iOS.DataTypes.DataTypeManager:get_Instance ()' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information".  The singleton in question is used fairly extensively in our code base, both in managed and native code, which makes us wonder if there might be some sort of race condition.

We are wondering if there are some edge cases or a possible race conditions where "mono_aot_get_method" in the runtime is returning a NULL?  We are wondering if you have any suggestions on how to get some further diagnostic information, or any other thoughts on why this might be happening randomly.

namespace Faithlife.iOS.DataTypes
{
	[Register("DataTypeManager")]
	public class DataTypeManager : NSObject
	{
		[Export("sharedManager")]
		public static DataTypeManager Instance
		{
			get { return s_instance; }
		}

		DataTypeManager()
		{
			try
			{
				m_lbxManager = LbxDataTypeManager.Instance;
				m_dataTypes = new Dictionary<LbxDataType, DataType>();
				m_unknownDataTypes = new ConcurrentDictionary<string, OpaqueDataType>();
			}
			catch (Exception e)
			{
				Log.Error("Failed to instantiate DataTypeManager: {0}", e);
				throw e;
			}
		}

		static readonly DataTypeManager s_instance = new DataTypeManager();
		static readonly Logger Log = LogManager.GetLogger(typeof(DataTypeManager).Name);

		readonly LbxDataTypeManager m_lbxManager;
		readonly Dictionary<LbxDataType, DataType> m_dataTypes;
		readonly ConcurrentDictionary<string, OpaqueDataType> m_unknownDataTypes;
	}
}



Xamarin.iOS
Version: 9.0.1.20 (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400
Comment 1 Zoltan Varga 2015-12-09 17:12:23 UTC
That should work fine, could you attach a complete test project so we can reproduce the problem ?
Comment 2 Todd Diehl 2015-12-09 23:07:24 UTC
Based on some analytics, this appears to only happen about 1 in 1000 times for users.  I don't currently have a test project, other than our shipping app, to reproduce the problem because it is somewhat erratic, and we haven't been able to reliably reproduce the problem yet.

Are there things you could suggest investigating on our end in order to try to narrow things down?
Comment 3 Zoltan Varga 2015-12-09 23:23:16 UTC
Is there any stack trace when the error is happening ? Does it happen when the method is called by c# code, or when its is called from objective-c ?
Comment 4 Todd Diehl 2015-12-09 23:33:41 UTC
We seem to be getting the exception from c# code, though the code is called by both c# and objective-c.

Unfortunately there is nothing in the stack trace, just the message.

Message: [ExecutionEngineException: Attempting to JIT compile method 'Faithlife.iOS.DataTypes.DataTypeManager:get_Instance ()' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information. ]
Comment 5 Sebastien Pouliot 2016-03-11 00:32:07 UTC
Could you tell us if this is still an issue with the latest (9.8) alpha ?
Comment 6 Sebastien Pouliot 2016-04-12 15:43:34 UTC
We have not received further information and will assume this is not an issue anymore. If you can still affected by this please re-open the bug and include the requested information. Thanks.