Is it normal to have multiple entries in Settings_ShellFeatureRecord table with the same name?

Topics: Troubleshooting
Feb 20, 2014 at 3:36 PM
I have multiple entries in the Settings_ShellFeatureRecord table for several items (some written by us, some not).

For example:

Orchard Scripting (6)
Orchard.Packaging (2)
Orchard.Fields (2)

one of our own modules/features is listed 123 times...each has a different id.

I believe it might relate to

1) We are in a load balanced server farm in azure
2) I see the following error message far too often in logs
Error executing command "feature list"
--------------------------------------------------------------------------------

query did not return a unique result: 4

Exception Details: NHibernate.NonUniqueResultException: query did not return a u
nique result: 4

Stack Trace:

[NonUniqueResultException: query did not return a unique result: 4]
   at NHibernate.Impl.AbstractQueryImpl.UniqueElement(IList list) in c:\Users\se
bros\Documents\My Projects\nhibernate-core\src\NHibernate\Impl\AbstractQueryImpl
.cs:line 975
   at NHibernate.Impl.AbstractQueryImpl.UniqueResult[T]() in c:\Users\sebros\Doc
uments\My Projects\nhibernate-core\src\NHibernate\Impl\AbstractQueryImpl.cs:line
 948
   at Orchard.Mvc.MvcModule.HttpContextBaseFactory(IComponentContext context) in
 c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Mvc\MvcModule.cs:line
61
   at Orchard.Mvc.MvcModule.RequestContextFactory(IComponentContext context) in
c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Mvc\MvcModule.cs:line 8
3
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0
(IComponentContext c, IEnumerable`1 p) in c:\Projects\OSS\autofac\Core\Source\Au
tofac\Builder\RegistrationBuilder.cs:line 36
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(ICompo
nentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\S
ource\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Ser
vice service, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\A
utofac\ResolutionExtensions.cs:line 346
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context,
IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Resolut
ionExtensions.cs:line 197
   at Orchard.Mvc.MvcModule.UrlHelperFactory(IComponentContext context) in c:\Te
amCity\buildAgent\work\a8902095db2d0703\src\Orchard\Mvc\MvcModule.cs:line 90
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0
(IComponentContext c, IEnumerable`1 p) in c:\Projects\OSS\autofac\Core\Source\Au
tofac\Builder\RegistrationBuilder.cs:line 36
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(ICompo
nentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\S
ource\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 114
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC
omponentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Co
re\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 cr
eator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScop
e.cs:line 270
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 114
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC
omponentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Co
re\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 cr
eator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScop
e.cs:line 270
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 64
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClas
s4.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p) in c:\Projects\O
SS\autofac\Core\Source\Autofac\Features\Collections\CollectionRegistrationSource
.cs:line 75
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(ICompo
nentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\S
ource\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(ICompo
nentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Core\S
ource\Autofac\Core\Activators\Delegate\DelegateActivator.cs:line 69
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\Projects\OSS\autofac
\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti
meScope currentOperationScope, IComponentRegistration registration, IEnumerable`
1 parameters) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\Reso
lveOperation.cs:line 123
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate
() in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Activators\Reflection\Con
structorParameterBinding.cs:line 114
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC
omponentContext context, IEnumerable`1 parameters) in c:\Projects\OSS\autofac\Co
re\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 122
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) i
n c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Resolving\InstanceLookup.cs:l
ine 79
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 cr
eator) in c:\Projects\OSS\autofac\Core\Source\Autofac\Core\Lifetime\LifetimeScop
e.cs:line 270

...
This seems to be causing us problems with enabling/disabling modules across all our environments.

Could I get a response on whether the tables look as expected? (obviously the error is not expected ;) )
Developer
Feb 20, 2014 at 3:55 PM
I have seen this happening before, but I don't know if it is intentional or not. I don't see a good reason to have duplicate records, and it does seem like a bug. De-duping never caused any issues for me, so it looks like a bug. Others may know more about this though. I would file a bug, ideally with repro steps to get duplicate records.
Feb 20, 2014 at 4:18 PM
The end of the error seems more telling. It seems to be complaining about culture settings
:line 13
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`
2 predicate)
   at Orchard.Environment.WorkContextImplementation.FindResolverForState[T](Stri
ng name) in c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Environment
\WorkContextImplementation.cs:line 32
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Fu
nc`2 valueFactory)
   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in
c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Environment\WorkContext
Implementation.cs:line 28
   at Orchard.Localization.Services.SiteCultureSelector.GetCulture(HttpContextBa
se context) in c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Localiza
tion\Services\SiteCultureSelector.cs:line 13
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Orchard.Localization.Services.DefaultCultureManager.GetCurrentCulture(Http
ContextBase requestContext) in c:\TeamCity\buildAgent\work\a8902095db2d0703\src\
Orchard\Localization\Services\DefaultCultureManager.cs:line 64
   at Orchard.Localization.Services.CurrentCultureWorkContext.<Get>b__0[T](WorkC
ontext ctx) in c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Localiza
tion\Services\CurrentCultureWorkContext.cs:line 13
   at Orchard.Environment.WorkContextImplementation.<>c__DisplayClass7`1.<FindRe
solverForState>b__5() in c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchar
d\Environment\WorkContextImplementation.cs:line 37
   at Orchard.Environment.WorkContextImplementation.GetState[T](String name) in
c:\TeamCity\buildAgent\work\a8902095db2d0703\src\Orchard\Environment\WorkContext
Implementation.cs:line 28
   at Orchard.Localization.Text.Get(String textHint, Object[] args) in c:\TeamCi
ty\buildAgent\work\a8902095db2d0703\src\Orchard\Localization\Text.cs:line 30
   at Orchard.Modules.Commands.FeatureCommands.List() in c:\TeamCity\buildAgent\
work\a8902095db2d0703\src\Orchard.Web\Modules\Orchard.Modules\Commands\FeatureCo
mmands.cs:line 34
It is stopping me from running any commands on the instance :(