OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Setup fails with exception on 1.x f7f55be #4379

Closed orchardbot closed 9 years ago

orchardbot commented 10 years ago

@jasper-d created: https://orchard.codeplex.com/workitem/20550

Repro:

$ git checkout f7f55be #can repro with b1d4905 too Clear App_Data folder Start Orchard without debugger (Ctrl + F5) Enter "test" as site name Enter "adminadmin" as password and password confirmation

Run setup (leave all other settings untouched)

Expected: Setup should run without any problems

Actual: Setup fails and displays the following error notification:

Setup failed: null id in Orchard.Core.Settings.Metadata.Records.ContentTypeDefinitionRecord entry (don't flush the Session after an exception occurs)

Log: 2014-03-12 00:16:23,814 [20] Orchard.Data.Migration.DataMigrationManager - Default - Error while running migration version 0 for Settings System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.OutOfMemoryException: Insufficient memory to continue the execution of the program. at System.Runtime.InteropServices.Marshal.AllocCoTaskMem(Int32 cb) at System.Data.SqlServerCe.Accessor.AllocData() at System.Data.SqlServerCe.SqlCeCommand.CreateAccessorFromParameterList() at System.Data.SqlServerCe.SqlCeCommand.CreateDataBindings() at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\AdoNet\AbstractBatcher.cs:line 203 at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Id\Insert\AbstractSelectingDelegate.cs:line 38 at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Boolean[] notNull, SqlCommandInfo sql, Object obj, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 2575 at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 3035 at NHibernate.Action.EntityIdentityInsertAction.Execute() in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Action\EntityIdentityInsertAction.cs:line 75 at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Engine\ActionQueue.cs:line 136 at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 259 at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 187 at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\AbstractSaveEventListener.cs:line 119 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 162 at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveEventListener.cs:line 27 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 148 at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveEventListener.cs:line 21 at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Event\Default\DefaultSaveOrUpdateEventListener.cs:line 53 at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 2673 at NHibernate.Impl.SessionImpl.Save(Object obj) in c:\Users\sebros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\SessionImpl.cs:line 485 at Orchard.Data.Repository1.Create(T entity) in c:\Sources\orchard\src\Orchard\Data\Repository.cs:line 96 at Orchard.Data.Repository1.Orchard.Data.IRepository.Create(T entity) in c:\Sources\orchard\src\Orchard\Data\Repository.cs:line 36 at Orchard.Core.Settings.Metadata.ContentDefinitionManager.Acquire(ContentTypeDefinition contentTypeDefinition) in c:\Sources\orchard\src\Orchard.Web\Core\Settings\Metadata\ContentDefinitionManager.cs:line 166 at Orchard.Core.Settings.Metadata.ContentDefinitionManager.StoreTypeDefinition(ContentTypeDefinition contentTypeDefinition) in c:\Sources\orchard\src\Orchard.Web\Core\Settings\Metadata\ContentDefinitionManager.cs:line 109 at Orchard.ContentManagement.MetaData.ContentDefinitionManagerExtensions.AlterTypeDefinition(IContentDefinitionManager manager, String name, Action`1 alteration) in c:\Sources\orchard\src\Orchard\ContentManagement\MetaData\IContentDefinitionManager.cs:line 27 at Orchard.Core.Settings.Migrations.Create() in c:\Sources\orchard\src\Orchard.Web\Core\Settings\Migrations.cs:line 85 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Orchard.Data.Migration.DataMigrationManager.Update(String feature) in c:\Sources\orchard\src\Orchard\Data\Migration\DataMigrationManager.cs:line 113 2014-03-12 00:16:23,870 [20] NHibernate.AssertionFailure - Default - An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types. NHibernate.AssertionFailure: null id in Orchard.Core.Settings.Metadata.Records.ContentTypeDefinitionRecord entry (don't flush the Session after an exception occurs)

The cause of this exception is the following line in AbstractDataServicesProvider: .SetProperty(NHibernate.Cfg.Environment.PrepareSql, Boolean.TrueString)

Removing this line solves the issue. Please note, I've tested it with SqlCE only, so I don't know if this is a problem when using SQL Server or MySQL.

orchardbot commented 10 years ago

@jasper-d commented:

I've tested f7f55be using LocalDB 11 MySql 5.6.16 and it's working. As a quick workaround without knowing the actual problem, one can change the line to .SetProperty(NHibernate.Cfg.Environment.PrepareSql, (database is MsSqlCeConfiguration) ? Boolean.FalseString : Boolean.TrueString) to run Orchard using SqlCe.

orchardbot commented 10 years ago

@sfmskywalker commented:

I am seeing the exact same thing.

orchardbot commented 10 years ago

@sfmskywalker commented:

The problem doesn't occur when using SQL Server Express. So based on JasperD's findings, it seems to be isolated to the SQL Server CE case.

orchardbot commented 10 years ago

@sebastienros commented:

Fixed in changeset da6a636247a446c2fbd8d23f4fc10787149a281c

orchardbot commented 10 years ago

@jasper-d commented:

Any reason PrepareSql is now disabled when using MySql?

orchardbot commented 10 years ago

@sebastienros commented:

Just because I had confirmation it worked with SqlServer but not yet for MySQL, and I didn't want to add any other bug. If you can confirm it works fine then I will add it.

orchardbot commented 10 years ago

@jasper-d commented:

I've tested f7f55be using LocalDB 11 [and] MySql 5.6.16 and it's working.

Yes, I can confirm that. :)

Thanks.

orchardbot commented 10 years ago

@sebastienros commented:

done

orchardbot commented 10 years ago

besicdenis commented:

I am experiencing same issue on Microsoft SQL Server Enterprise (64-bit) version 11.0.5058.0.

orchardbot commented 10 years ago

besicdenis commented:

Please ignore previous comment. My bad.