Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Wright (suedeapple) 277 posts 704 karma points
    May 11, 2017 @ 10:28
    Paul Wright (suedeapple)
    0

    Database Error when using Umbraco 7.6.1 and TeaCommerce 3.2.2

    Test Case 1

    1. Umbraco: 7.6.1
    2. TeaCommerce: 3.2.2
    3. Hosting Environment : Windows Azure/DB

    I seem to get an error when calling "AddOrUpdateOrderLine" - Looking at the error, it relates to the fact that the Database reader has already been closed. I think this might be related to https://our.umbraco.org/documentation/Getting-Started/Setup/Upgrading/760-breaking-changes and (U4-9201) specifically

    Test Case 2

    1. Umbraco: 7.5.13
    2. TeaCommerce: 3.2.2
    3. Hosting Environment : Windows Azure/DB

    Just reverting back to 7.5.13. Everything works as normal, I can use "AddOrUpdateOrderLine", with no errors from TC.

    I think you might be able to get around this by setting "Multiple Active Result Sets" (MARS) - However on my particular Azure Database, I cant override this locally, and cant (currently) find a way to change this through the AZURE control panel.

  • Anders Burla 2560 posts 8256 karma points
    May 16, 2017 @ 09:40
    Anders Burla
    0

    Might be because of Umbraco 7.6. Someone tried to update to 7.6.1 and it worked.

    https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/issues/58

    Kind regards

    Anders

  • John Bergman 483 posts 1132 karma points
    May 18, 2017 @ 22:43
    John Bergman
    0

    I'm running on 7.6.1 and had upgraded from 7.5.13 to 7.6.0 to 7.6.1 without any issues with 3.2.2

  • Marcus Maunula 229 posts 386 karma points
    Jun 01, 2017 @ 21:24
    Marcus Maunula
    0

    We have the same problem with 3.2.2 and 7.6.2. It either locks up the reader och when posting. The db is a SQLServer2016

    Anything to be done here?

  • Marcus Maunula 229 posts 386 karma points
    Jun 01, 2017 @ 21:25
    Marcus Maunula
    0

    Btw, is there a way to force close the underlying db?

  • John Bergman 483 posts 1132 karma points
    Jun 02, 2017 @ 06:49
    John Bergman
    0

    I believe 7.6.2/7.6.3 fixed a datareader issue, maybe that would correct your problem?

  • Anders Burla 2560 posts 8256 karma points
    Jun 02, 2017 @ 08:06
    Anders Burla
    0

    Its pretty weird as Tea Commerce use its own instance of PetaPoco in the Core and not the one from Umbraco. So it might be because of the hosting environment??

    You can see that we use the connection string from Umbraco but thats it. The Database class is PetaPoco that is a .cs file in the Tea Commerce core.

    https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Configuration/Persistence/DatabaseFactory.cs

    Kind regards

    Anders

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Jun 02, 2017 @ 11:38
    Paul Wright (suedeapple)
    0

    Agreed, it maybe due to the hosting environment, and how multiple connections to the DB are handled. (Windows Azure).

    As Umbraco Cloud runs on "windows azure", I think it would be worthwhile checking that TeaCommerce 3.2.2 works on 7.6.2, on the Cloud.

    @Anders, in your link, I notice we have this line

      return new Database( "umbracoDbDSN" );
    

    Which is the main connection string name used by Umbraco - maybe the issue is here??

    I'm not ultra-techy I'm afraid - so I maybe I'm barking up the wrong tree :-)

  • Marcus Maunula 229 posts 386 karma points
    Jun 02, 2017 @ 16:25
    Marcus Maunula
    0

    Few gotchas.

    -It is not Azure but a regular HostedVM that works for everything else. -I have used that MultipleResultSets but no go.

    Anders: Any chance you could ask the Core team about this?

    I will reinstall on a new 7.6.3 and see what happens

  • Marcus Maunula 229 posts 386 karma points
    Jun 02, 2017 @ 19:48
    Marcus Maunula
    0

    7.6.3 and this is what happens (still).

    Message":"An error has occurred.","ExceptionMessage":"Invalid attempt to call Read when reader is closed.","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)\r\n at System.Data.SqlClient.SqlDataReader.Read()\r\n at umbraco.DataLayer.RecordsReaderAdapter1.Read()\r\n at TeaCommerce.Umbraco.Configuration.Compatibility.Domain.GetDomainsById(Int32 nodeId)\r\n at TeaCommerce.Umbraco.Configuration.Services.LanguageService.GetLanguageIdByNodePath(String nodePath)\r\n at TeaCommerce.Umbraco.Configuration.InformationExtractors.PublishedContentProductInformationExtractor.GetLanguageId(IPublishedContent product, VariantPublishedContent variant)\r\n at TeaCommerce.Umbraco.Configuration.InformationExtractors.PublishedContentProductInformationExtractor.GetSnapshot(String productIdentifier)\r\n at TeaCommerce.Api.Services.ProductService.GetSnapshot(String productIdentifier)\r\n at TeaCommerce.Api.Models.OrderLineCollection.AddOrUpdate(String productIdentifier, Nullable1 quantity, IDictionary2 properties, Boolean overwriteQuantity, String bundleIdentifier, String parentBundleIdentifier)\r\n at TeaCommerce.Api.Web.TeaCommerceHelper.AddOrUpdateOrderLine(Int64 storeId, String productIdentifier, Nullable1 quantity, IDictionary2 properties, Boolean overwriteQuantity, String bundleIdentifier, String parentBundleIdentifier)\r\n at in ..:line 20\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at

  • Marcus Maunula 229 posts 386 karma points
    Jun 02, 2017 @ 20:31
    Marcus Maunula
    0

    This last was an attempt with a WebApi call but it did not work as I had hoped.

  • Marcus Maunula 229 posts 386 karma points
    Jun 02, 2017 @ 20:43
    Marcus Maunula
    0

    Anders.

    We just bought this license and we have a customer that is expecting to see some examples tomorrow. Any chance for a quick fix on the db-issue?

  • Anders Burla 2560 posts 8256 karma points
    Jun 06, 2017 @ 08:25
    Anders Burla
    0

    Hi Marcus

    Just looked into your stack trace and it looks like it has something to do with the SqlHelper used in TeaCommerce.Umbraco.Configuration.Compatibility.Domain.GetDomainsById. That should properly use the DatabaseContext instead now that we only need to support Umbraco 7. Do you guys have a developer that have the time to look into that right now? The code is right here on GitHub and open source so you can change it.

    https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/dev/Source/TeaCommerce.Umbraco.Configuration/Compatibility/Domain.cs

    Else - we at the core team need to have access to your hosting environment, your entire solution and instructions on how to replicate this bug on your setup. Then we can try and fix it and upload a new dll and see if that fixes the issue. We have not had this problem our self as we have own hosting.

    Sorry about the problems - that is what happens when Umbraco upgrades its code :)

    Kind regards

    Anders

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 10:28
    Marcus Maunula
    0

    Should be added that the error is the same as the original poster. Except we use HostedVM and I have tried MARS without any luck.

    Now on 7.6.3

  • Anders Burla 2560 posts 8256 karma points
    Jun 06, 2017 @ 13:25
    Anders Burla
    0

    The problem is the same - the initial stater it the add or update order lines - but ends in the Domain code that I posted earlier today. So the problem is with the domain code and the SqlHelper used there from Umbraco.

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 10:25
    Marcus Maunula
    0

    Hi Anders,

    You can ask Johan Sandström about the environment. I have tried all versions, using the form, javascript and using a backend controller. All fail on the database issue.

    I will download this and see if I can change it.

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Jun 06, 2017 @ 11:00
    Paul Wright (suedeapple)
    0

    Not sure if this is related, but even the TeaCommerce demo site isnt working. (running on 7.6.2)

    The issue only occurs on the Product Variant page...

    https://demo.teacommerce.net/very-expensive-yachts/one-masted-yacht/

    (try, Selecting a Colour and then a size - The size always remains greyed out, and you cant add to cart)

    The "simple" product page, seems to be acting "OK"

    https://demo.teacommerce.net/expensive-yachts/summer-yacht/

    Over to you Anders :-)

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 11:16
    Marcus Maunula
    0

    Should be added that the online version seems to be different from the download version. If I understood that correctly from previous comments.

    I have tried installing everything with 7.5.x and it seems to work also. Problems started with 7.6 apparently.

  • Anders Burla 2560 posts 8256 karma points
    Jun 06, 2017 @ 13:24
    Anders Burla
    0

    That has nothing to do with the database problem - seems like another problem.

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 11:34
    Marcus Maunula
    0

    As far as I am concerned. This is the key to everything.

    System.InvalidOperationException: Invalid attempt to call Read when reader is closed. at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) at System.Data.SqlClient.SqlDataReader.Read() at umbraco.DataLayer.RecordsReaderAdapter`1.Read()

    When calling TC.addOrUpdateOrderLine({storeId:1, productIdentifier:(anything), quantity:1}); from script or otherwise.

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 11:37
    Marcus Maunula
    0

    This is a default formpost

    2017-06-06 13:36:54,953 [P4848/D7/T50] ERROR TeaCommerce.Api.Web.FormPostHandler - FormPost error --- Form data: -- AddOrUpdateOrderLine = "productIdentifier, quantity" -- storeId = "1" -- productIdentifier = "1388" -- quantity = "1"

    System.InvalidOperationException: Invalid attempt to call Read when reader is closed. at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) at System.Data.SqlClient.SqlDataReader.Read() at umbraco.DataLayer.RecordsReaderAdapter1.Read() at TeaCommerce.Umbraco.Configuration.Compatibility.Domain.GetDomainsById(Int32 nodeId) at TeaCommerce.Umbraco.Configuration.Services.LanguageService.GetLanguageIdByNodePath(String nodePath) at TeaCommerce.Umbraco.Configuration.InformationExtractors.PublishedContentProductInformationExtractor.GetSnapshot(String productIdentifier) at TeaCommerce.Api.Models.OrderLineCollection.AddOrUpdate(String productIdentifier, Nullable1 quantity, IDictionary2 properties, Boolean overwriteQuantity, String bundleIdentifier, String parentBundleIdentifier) at TeaCommerce.Api.Web.TeaCommerceHelper.AddOrUpdateOrderLine(Int64 storeId, String productIdentifier, Nullable1 quantity, IDictionary2 properties, Boolean overwriteQuantity, String bundleIdentifier, String parentBundleIdentifier) at TeaCommerce.Api.Web.FormPostHandler.AddOrUpdateOrderLine(Int64 storeId, IDictionary2 formFields, IDictionary`2 settings) at TeaCommerce.Api.Web.FormPostHandler.FormPost()

  • Anders Burla 2560 posts 8256 karma points
    Jun 06, 2017 @ 13:28
    Anders Burla
    1

    Still the same error as before :) Need a way to help you debug and reproduce. I can not do that on my own local machine and hosting setup.

    Kind regards

    Anders

  • Marcus Maunula 229 posts 386 karma points
    Jun 06, 2017 @ 16:59
    Marcus Maunula
    0

    I have no tried changing that domain method to a different method using UmbracoContext and now everything works :).

    So we can confirm that this is the solution.

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Jun 06, 2017 @ 17:13
    Paul Wright (suedeapple)
    0

    Awesome! - Can you post your code? :-)

  • Marcus Maunula 229 posts 386 karma points
    Jun 07, 2017 @ 20:30
    Marcus Maunula
    0

    Nothing dramatic. I just switched the database reader to the PetaPoco one.

           public static umbraco.cms.businesslogic.web.Domain[] GetDomainsById(int nodeId)
        {
            var db = ApplicationContext.Current.DatabaseContext.Database;
    
            List<umbraco.cms.businesslogic.web.Domain> domains = CacheService.Instance.GetCacheValue<List<umbraco.cms.businesslogic.web.Domain>>(CacheKey);
    
            if (domains == null)
            {
                domains = new List<umbraco.cms.businesslogic.web.Domain>();
                var result = db.Fetch<dynamic>("select id, domainName from umbracoDomains");
                foreach (var domain in result)
                {
                    var domainName = domain.domainName;
                    var domainId = (int)domain.id;
                    if (domains.All(d => d.Name != domainName))
                    {
                        domains.Add(new umbraco.cms.businesslogic.web.Domain(domainId));
                    }
                }
    
    
                CacheService.Instance.SetCacheValue(CacheKey, domains);
            }
    
            return domains.Where(d => d.RootNodeId == nodeId).ToArray();
        }
    

    Might be nicer to use a model but I assume Anders will do a proper fix anyway so this was just quick and dirty ;).

  • Niall McCabe 10 posts 80 karma points
    Sep 28, 2017 @ 14:01
    Niall McCabe
    0

    Hi

    Is there a timeframe for a release of this fix? We are experiencing the same issue.

    Thanks

    Niall

  • Anders Burla 2560 posts 8256 karma points
    Sep 28, 2017 @ 14:10
    Anders Burla
    0

    Not yet. But you can download and build the project with the fix here: https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/tree/dev

    Just download and go to the build folder and run the release bat file. You just need VS so you have MS build. Then you will have a zip file to install or just overwrite the bin file.

    Let me know if that works for you.

    Kind regards

    Anders

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Sep 28, 2017 @ 14:17
    Paul Wright (suedeapple)
    0

    Brill - thanks Anders, this has been an annoying show stopper for a while - so it'll be nice to get an official release for it. Us being paying licensee owners :-)

  • Anders Burla 2560 posts 8256 karma points
    Sep 28, 2017 @ 14:22
    Anders Burla
    0

    Sorry about that. We will see if we can get a release pretty soon then :)

  • Simon 14 posts 36 karma points
    Oct 10, 2017 @ 14:54
    Simon
    0

    Hi Anders,

    Any further news on an update? We have a few clients also waiting for an official release.

    Thanks

  • Anders Burla 2560 posts 8256 karma points
    Oct 10, 2017 @ 15:09
    Anders Burla
    0

    Hi Simon

    Please vote for this issue as it limits us for releasing an update at the moment.

    http://issues.umbraco.org/issue/U4-10519

    Kind regards

    Anders

  • Simon 14 posts 36 karma points
    Oct 17, 2017 @ 16:31
    Simon
    0

    Hi Anders,

    Looks like the Umbraco team fixed this, all good your end now?

  • Anders Burla 2560 posts 8256 karma points
    Oct 18, 2017 @ 07:12
    Anders Burla
    0

    Hi Simon

    Yes it should be fixed. We will test this week.

  • Tiago 12 posts 94 karma points
    Oct 30, 2017 @ 12:43
    Tiago
    0

    Hi!

    Is anybody experiencing the exception with umbraco 7.6.4?

    When I try and add the product tothe order, via the javascript API, this error occurs.

  • Tiago 12 posts 94 karma points
    Oct 31, 2017 @ 11:01
    Tiago
    0

    Resolved the issue by updating to 3.2.3 with umbraco 7.6.4, all working correctly.

Please Sign in or register to post replies

Write your reply to:

Draft