Qlik Sense repository failure to start after a windows upgrade
This week we had an interesting support case to fix and I thought I would share the finding in case someone else has the same problem we did.
One of our customers had a Qlik Sense server that needed to have Windows (Windows 2012 R2 x64) updates applied. After Windows Update had completed the server restarted and upon restart the Qlik Sense Repository service would no longer start.
The error in the System_Repository.txt log was the following:
Unable to determine the provider name for provider factory of type 'Devart.Data.PostgreSql.PgSqlProviderFactory'
After reviewing the update logs, I found that many updates and security patches where applied to the .Net framework that was installed on the server. I assumed that one of these updates had uninstalled the Qlik Sense PostgreSQL drivers and I should attempt to re-register the missing DLL by using the GACUtil.exe tool. After re-registering the DLL, the Qlik Sense Repository service still would not start.
At the same time, Qlik Support team had responded back to me. Based on their feedback, I was able to edit the server’s machine.config (found in %windir%\Microsoft.NET\Framework\v4.0.30319\config\machine.config) file and fix the problem. Here is a screenshot of the problem.
You will see that in the System.Data section of the machine.config file there is a second DbProviderFactories node. Removing this second entry and restarting the server fixed the problem. The Qlik Sense Repository started up and everything was back online.
As special thanks to Pierce @ Qlik Technical support and to Mike over at stackoverflow.com for helping getting this problem resolved.
Here is the full stacktrace of the problem from the logs.
8 20160309T111920.895-0500 ERROR XXXXXXX System.Repository.Repository.Core.Repository.Common.ModelRepository`1[[Repository.Domain.Model.LocalConfig, Repository.Domain, Version=2.1.1.0, Culture=neutral, PublicKeyToken=null]] 14 08513d28-2a50-43de-8973-903425e70657 NT AUTHORITY\SYSTEM Unexpected error in ExecuteGetAll Unable to determine the provider name for provider factory of type 'Devart.Data.PostgreSql.PgSqlProviderFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.↵↓An exception was thrown while invoking the constructor 'Void .ctor()' on type 'DatabaseContext'. ---> Unable to determine the provider name for provider factory of type 'Devart.Data.PostgreSql.PgSqlProviderFactory'. Make sure that the ADO.NET provider is installed or registered in the application config. (See inner exception for details.) at System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(Type type, Object key)↵↓ at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key)↵↓ at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()↵↓ at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)↵↓ at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()↵↓ at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)↵↓ at System.Data.Entity.Internal.InternalConnection.get_ProviderName()↵↓ at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)↵↓ at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()↵↓ at System.Data.Entity.Internal.InternalContext.Initialize()↵↓ at Repository.Core.Repository.Database.Common.AbstractDatabaseContext..ctor()↵↓ at lambda_method(Closure , Object[] )↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)↵↓ at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)↵↓ at Autofac.Core.Resolving.InstanceLookup.Execute()↵↓ at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at lambda_method(Closure )↵↓ at Repository.Core.Repository.Common.EntityTransactionRepository.All[T](Boolean includeDeleted)↵↓ at Repository.Core.Repository.Common.EntityTransactionRepository.Find[T](Expression`1 expression, Boolean includeDeleted)↵↓ at Repository.Core.Repository.Common.ModelRepository`1.ExecuteGetAll(Expression expression, Boolean appendPrivileges, Int64 privilegesFilter, Func`2 queryModifier) 08513d28-2a50-43de-8973-903425e70657
9 20160309T111921.565-0500 ERROR XXXXXXX System.Repository.Repository.QRSMain 14 f49d0072-30c1-4e2e-bcca-8f016ff0ad38 NT AUTHORITY\SYSTEM Fatal exception Unable to determine the provider name for provider factory of type 'Devart.Data.PostgreSql.PgSqlProviderFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.↵↓An exception was thrown while invoking the constructor 'Void .ctor()' on type 'DatabaseContext'. ---> Unable to determine the provider name for provider factory of type 'Devart.Data.PostgreSql.PgSqlProviderFactory'. Make sure that the ADO.NET provider is installed or registered in the application config. (See inner exception for details.)↵↓The "GetAll" operation failed↵↓An exception was thrown while invoking the constructor 'Void .ctor(Qlik.Sense.Logging.IQSLogManager, Repository.Core.INodeStaticInfo, Qlik.Sense.Common.Security.ISecuritySetup, Qlik.Sense.Common.Communication.REST.Server.IRESTEngineFactory, Repository.Core.ISystemInformation, Qlik.Sense.IO.ISystemFolderInformation, Repository.Core.Certificates.ICertificatePasswordVerificationWebService, Qlik.Sense.Common.Logging.ILogMaster)' on type 'SetupService'. ---> The "GetAll" operation failed (See inner exception for details.) at System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(Type type, Object key)↵↓ at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key)↵↓ at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()↵↓ at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)↵↓ at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()↵↓ at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)↵↓ at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)↵↓ at System.Data.Entity.Internal.InternalConnection.get_ProviderName()↵↓ at System.Data.Entity.Internal.DefaultModelCacheKeyFactory.Create(DbContext context)↵↓ at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()↵↓ at System.Data.Entity.Internal.InternalContext.Initialize()↵↓ at Repository.Core.Repository.Database.Common.AbstractDatabaseContext..ctor()↵↓ at lambda_method(Closure , Object[] )↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)↵↓ at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)↵↓ at Autofac.Core.Resolving.InstanceLookup.Execute()↵↓ at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at lambda_method(Closure )↵↓ at Repository.Core.Repository.Common.EntityTransactionRepository.All[T](Boolean includeDeleted)↵↓ at Repository.Core.Repository.Common.EntityTransactionRepository.Find[T](Expression`1 expression, Boolean includeDeleted)↵↓ at Repository.Core.Repository.Common.ModelRepository`1.ExecuteGetAll(Expression expression, Boolean appendPrivileges, Int64 privilegesFilter, Func`2 queryModifier)↵↓ at Repository.Core.Repository.Common.ModelRepository`1.ExecuteGetAll(Expression expression, Boolean appendPrivileges, Int64 privilegesFilter, Func`2 queryModifier)↵↓ at Repository.Core.Repository.Common.ModelRepository`1.GetAll(Expression expression, Boolean appendPrivileges, Int64 privilegesFilter)↵↓ at Repository.Core.Repository.Common.SecurityAwareRepository.RunWithoutSecurity[TResult](Func`1 func)↵↓ at Repository.Core.Settings.LocalConfigStash.GetFromRepository(LocalConfigKey key, ISecurityAwareRepository repository)↵↓ at Qlik.Sense.Common.Ioc.WorkScope.Work[T,TResult](Func`2 func)↵↓ at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)↵↓ at Repository.Core.Settings.LocalConfigStash.TryGet(LocalConfigKey key, LocalConfigCachePolicy cachePolicy, ISecurityAwareRepository repository, LocalConfig& localConfig)↵↓ at Repository.Core.Settings.LocalConfigStash.Get[T](LocalConfigKey key, T defaultValue, LocalConfigCachePolicy cachePolicy)↵↓ at Repository.Core.SystemInformation.b__0(ISecurityAwareRepository repository)↵↓ at Qlik.Sense.Common.Ioc.WorkScope.Work[T](Action`1 action)↵↓ at Repository.Core.SystemInformation.GetTemporaryFolder(ISystemFolderInformation systemFolderInformation)↵↓ at Repository.Core.Services.SetupService..ctor(IQSLogManager logManager, INodeStaticInfo nodeInfo, ISecuritySetup securitySetup, IRESTEngineFactory restEngineFactory, ISystemInformation systemInformation, ISystemFolderInformation systemFolderInformation, ICertificatePasswordVerificationWebService certificatePwdWebService, ILogMaster logMaster)↵↓ at lambda_method(Closure , Object[] )↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Execute()↵↓ at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()↵↓ at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.InstanceLookup.Execute()↵↓ at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)↵↓ at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)↵↓ at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters)↵↓ at Qlik.Sense.Common.Ioc.WorkScope.Work[T](Action`1 action)↵↓ at Repository.QRSMain.Main() f49d0072-30c1-4e2e-bcca-8f016ff0ad38