Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error "Connection string changed, disposing context" when enabling Content Delivery API #16624

Open
fbpenalosa opened this issue Jun 19, 2024 · 11 comments
Labels
affected/v12 community/up-for-grabs state/needs-more-info We don't have enough information to give a good reply state/needs-reproduction Check if this can be reproduced in the latest released version type/bug

Comments

@fbpenalosa
Copy link

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

12.3.6

Bug summary

We are getting getting error "Connection string changed, disposing context" after we save and publish content nodes when Content Delivery API is enabled

Specifics

Additional Specs:
Umbraco 12.3.6
USkinned 5.2.0
USyn 12.2.3

Issue Details
We've recently enabled Content Delivery API. After doing that we noticed that we are getting this warning error after we save and publish any content nodes:

“Connection string changed, disposing context“

Here's an example screenshot of the event:

image

In this example, two of those errors got logged after we published a content node.

Here's some details for that log:
image

We got rid of these errors for now by completely disabling the Content Delivery API, meaning:

  • In the appSettings.config we set Enabled = False
    image

  • And removed AddDeliveryApi() from Startup.cs
    image

I'm not sure what's going or if we need to adjust something

Steps to reproduce

Enable Content Delivery API by following the manual: https://docs.umbraco.com/umbraco-cms/v/12.latest/reference/content-delivery-api#enable-the-content-delivery-api

  1. Enable in AppSettings.config

image

  1. Add Delivery API in Startup.cs service builder
    image

  2. Save and publish any content page

Please note that we're unable to replicate this locally. These were observed and replicated in deployed instances.

Expected result / actual result

No errors on logs when saving and publishing content pages while Content Delivery API is enabled

Copy link

Hi there @fbpenalosa!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@Migaroez
Copy link
Contributor

Hey @fbpenalosa, thank you for reaching out and taking the time to flesh out this report.

Have you been able to reproduce this on a deployed instance with just umbraco running? So removing all packages including usync/uskinned?

@Migaroez Migaroez added the state/needs-more-info We don't have enough information to give a good reply label Jun 27, 2024
@fbpenalosa
Copy link
Author

fbpenalosa commented Jun 27, 2024

@Migaroez Thank you for the response.

Unfortunately, it's not possible to remove USync and USkinned as both of them are baked in our products and thus all of our deployed instances have them.

It's very interesting though that I cannot replicate this on my local instance which makes this hard to trace.
Would there be any difference on how CDA gets implemented locally vs on a deployed instance? As soon as I turn-off CDA by setting Enabled = False and removing AddDeliveryAPI() from Startup.cs, these warnings go away.

@Migaroez
Copy link
Contributor

There are no differences between local and deployed except for configuration and environment. If there is an increased access delay towards the persistence layer (sql database) then a race condition/timeout/... can explain a difference in behavior.

It seems very similar to this
#15090
And we partly fixed it in
#15410 which you already have active on your installation.

A follow up mitigation of the race condition was fixed in #15649

Could you try and update one of your solutions to v13.1.1+ to see if this resolves the problem?

@shallett-ghd
Copy link

There are no differences between local and deployed except for configuration and environment. If there is an increased access delay towards the persistence layer (sql database) then a race condition/timeout/... can explain a difference in behavior.

It seems very similar to this #15090 And we partly fixed it in #15410 which you already have active on your installation.

A follow up mitigation of the race condition was fixed in #15649

Could you try and update one of your solutions to v13.1.1+ to see if this resolves the problem?

There would be no appetite to merge this fix into version 12 I'm assuming?

@Migaroez
Copy link
Contributor

I am afraid not as v12 entered the security phase at the end of march.

Any reason why upgrading to v13 is not feasable? It should be a fairly easy upgrade and most mainstream packages have been available for v13 for a while and its an LTS afterall

@shallett-ghd
Copy link

Not that it's not feasible, it's just a longer development cycle than the need to enable this API allows.

As this is just a warning, what are the side effects of enabling this API with this occurring?

@fbpenalosa
Copy link
Author

fbpenalosa commented Jul 10, 2024

@Migaroez

I noticed something replicable locally.

To remove the ambiguity of USkinned and other packages, for this test I've used the Umbraco CMS Repo:

Repo: https://github.com/umbraco/Umbraco-CMS
Branch: v12/dev
Package: The only package I installed is the Umbraco Training site for initial content

Replication Steps:

  1. Insert .AddDeliveryApi() in Startup.cs of Umbraco.Web.UI (This was already there when I added the repo)
  2. Run the application
  3. While the application is running, open appSettings.config
  4. Modify any property value.

In my tests, I just played around with the Notifications email:

image

You would also notice in this screenshot that I haven't added any content delivery API settings

  1. Go to Umbraco logs and you would see the errors:

image

Please note that in Step 4, there were instances wherein I just modified a property and even without saving it, the error got generated anyway.

Again, this only happens when .AddDeliveryApi() is added on Startup.cs

The other thought is, is appSettings.config the only file that triggers this or if we update any other file, it will trigger this as well? That theory is yet to be tested too.

I wonder if you can try and replicate this on your end as well. Thank you.

@iOvergaard
Copy link
Contributor

By the looks of this thread, we need to see if this is still occurring in V13 (and potentially 14 and 15). We would like some help investigating this, so I'll mark the issue as up for grabs to maximise the chances of getting it closed sooner rather than later.

@iOvergaard iOvergaard added community/up-for-grabs state/needs-reproduction Check if this can be reproduced in the latest released version affected/v12 labels Oct 2, 2024
Copy link

github-actions bot commented Oct 2, 2024

Hi @fbpenalosa,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

@bartoszc9
Copy link

Hi!
I can confirm that this issue occurs also on version 13.1.0
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected/v12 community/up-for-grabs state/needs-more-info We don't have enough information to give a good reply state/needs-reproduction Check if this can be reproduced in the latest released version type/bug
Projects
None yet
Development

No branches or pull requests

5 participants