Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

ExecuteReader requires an open and available Connection Exception in EPiServer.DataAccess.Internal.ContentLoadDB

Vote:
 

I see this in a site I'm analyzing with Application Insights from various stored procedure calls, some examples are netContentListPaged, netContentDataLoad and netContentChildrenReferences.

ExecuteReader requires an open and available Connection. The connection's current state is open.

System.InvalidOperationException:
   at System.Data.SqlClient.SqlConnection.GetOpenConnection (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Data.SqlClient.SqlCommand.ValidateCommand (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Data.SqlClient.SqlCommand.ExecuteReader (System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at EPiServer.DataAccess.Internal.ContentLoadDB+<>c__DisplayClass2_0.<Load>b__0 (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor+<>c__DisplayClass31_0`1.<Execute>b__0 (EPiServer.Data, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute (EPiServer.Data, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Core.ContentProvider+<>c__DisplayClass127_0.<LoadContentFromCacheOrRepository>b__0 (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Framework.Cache.ObjectInstanceCacheExtensions.ReadThroughWithWait (EPiServer.Framework, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Core.Internal.ContentInstanceCache.ReadThrough (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItem (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   at EPiServer.Core.Internal.DefaultContentLoader.TryGet (EPiServer, Version=11.20.3.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7)
   
Looking at the code triggering above stacktracke I see a typical contentRepository.TryGet<ImageMedia>(imageReference, out var image) call where ImageMedia is a class that inherits ImageData.

Site is running .NET 4.7.1 and 11.20.3.0 as you can see above.

Any one seen similar and found a solution?

#251221
Edited, Mar 23, 2021 22:14
Vote:
 

Hello Johan,

We are facing same issue now you found any solution to this if so please share that will be greatful.

Thanks,

Deepa

#259170
Jul 20, 2021 5:33
A.D
Vote:
 

Hi, just bumping this thread. I recently upgraded a site from 11.20.0 to 11.20.17 (in non-prod only so far) and I'm now seeing this error regularly.

It typically happens when various scheduled jobs start (but not always - it's erratic),  - e.g., the link validation job or 'delayed publish job' appear often in the logs:

ERROR EPiServer.DataAbstraction.ScheduledJob: Job EPiServer.LinkAnalyzer.LinkValidationJob failed for the job 'Link Validation' with jobId ='<SOME GUID>' 
System.InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is closed.

Just wondering if anyone has further information. I'd rather know if there's an issue before pushing the upgrade to production.

thanks,

#294953
Jan 19, 2023 0:20
Vote:
 

Running into very similar errors while running the Search & Navigation Indexing Job on Episerver.Cms v12.22.3. Issue occured our of the blue after doing a database migration from a Cms 11 instance of the project.

 EPiServer.Find.Cms.ContentIndexer[0]
      An exception occurred while fetching content. ExecuteReader requires an open and available Connection. The connection's current state is open..

Not sure if it's related but I'm currious if anyone found a solution.

#307358
Aug 23, 2023 13:49
Vote:
 

My issue turned out to be a bug in Episerver.Framework 12.16.0 / Episerver.Cms 12.22.3. Once I downgraded to 12.22.1 the Search & Navigation Content Indexing Job started to work again. Assuming it has to do with the new Inline Block functionality.

#307361
Aug 23, 2023 18:04
Vote:
 

Thank you Sam for contributing.
We are currently working on a fix for this.

#307400
Aug 24, 2023 7:32
Vote:
 

This will be fixed with next CMS and Find package

CMS-29569 BackgroundContext should be isolated
https://world.optimizely.com/support/bug-list/bug/CMS-29569

FIND-11746 Background tasks should run in own context
(Bug not made public yet)

#307580
Aug 28, 2023 15:58
Johnny Mullaney - Dec 15, 2023 11:06
We're having a similar issue with Find.

Do you have more details on FIND-11746 - i cant find a bug in the list?
dada - Dec 15, 2023 15:41
Hi Johnny

FIND-11746 is associated with Find 15.2

15.2 was delisted due to other problems but this fix is available from Find 16 but I recommend the latest 16.0.1
Seems to be an issue with release notes associated with delisted packages. I will bring this up with engineering.
Johnny Mullaney - Dec 18, 2023 11:42
thank you for the update Daniel!
Vote:
 

CMS-29569 BackgroundContext should be isolated was part of 12.17.1 released yesterday.

More info:
https://world.optimizely.com/blogs/Johan-Bjornfot/Dates1/2023/8/parallel-tasks-and-backgroundcontext/

#307808
Sep 01, 2023 5:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.