Copied to clipboard

Flag this post as spam?

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


  • Jeremy Wiggins 7 posts 40 karma points
    Apr 18, 2012 @ 16:44
    Jeremy Wiggins
    0

    SQL timeout creating new topic

    When I try to create a new topic, I'm getting a SQL timeout.  I've been investigating using Profiler and have traced it down to the following:

    During the topic creation, the following command is sent to SQL Server:

    exec sp_executesql N'select umbracoNode.id, umbracoNode.parentId, umbracoNode.sortOrder, cmsContentXml.xml from umbracoNode  inner join cmsContentXml on cmsContentXml.nodeId = umbracoNode.id and umbracoNode.nodeObjectType = @type order by umbracoNode.level, umbracoNode.sortOrder',N'@type uniqueidentifier',@type='C66BA18E-EAF3-4CFF-8A22-41B16D66A972'

    This takes approximately 8 minutes to return.  In my site's database, that command returns over 7k rows.

    The next command is the following:

    exec sp_executesql N'INSERT INTO cmsContentXml(nodeId, xml) VALUES (@nodeId, @xml)',N'@nodeId int,@xml nvarchar(769)',@nodeId=138997,@xml=N'<ForumTopic id="138997" parentID="138988" level="5" writerID="0" creatorID="0" nodeType="138960" template="138949" sortOrder="0" createDate="2012-04-18T09:58:47" updateDate="2012-04-18T09:58:50" nodeName="Test" urlName="test" writerName="Administrator" creatorName="Administrator" path="-1,138973,138974,138976,138988,138997" isDoc=""><forumTopicOwnedBy>137977</forumTopicOwnedBy><forumTopicSubscribedList>137977|</forumTopicSubscribedList><pageTitle></pageTitle><metaDescription><![CDATA[]]></metaDescription><forumTopicClosed></forumTopicClosed><forumTopicSolved></forumTopicSolved><forumTopicIsSticky></forumTopicIsSticky><forumTopicLastPostDate>2012-04-18T09:58:49</forumTopicLastPostDate><forumTopicParentCategoryID>138974</forumTopicParentCategoryID></ForumTopic>'

    Obviously, this is where the xml of the forum post gets insert into cmsContentXml.  The problem is (I think) cmsContentXml is locked from the prior command.  So it times out attempting the insert.

    The end result is that the new topic is mostly created, but never gets published.  I can log into umbraco and publish it myself, but obviously it's a deal breaker for me if users can't create their own topics without admin interaction.

    I've tried toying with the indexes on the umbracoNode table, but to no avail, and I don't love this approach anyway, since now I'm modifying part of umbraco's core installation.

    Any help would be greatly appreciated.

  • Jeremy Wiggins 7 posts 40 karma points
    Apr 20, 2012 @ 17:11
    Jeremy Wiggins
    0

    Still struggling with this one.  I think it's somewhat of a race condition going on in the code that publishes a topic.  I downloaded the source and started tinkering with that method...

    What I've found is that if I issue a Thread.Sleep command in between publishing the topic and publishing the first post, it works.   

    [RestExtensionMethod]
    public static string NewForumTopic(string catId)
    {
        ...
    
        t.Publish(u);
        library.UpdateDocumentCache(t.Id);
    
        Thread.Sleep(2000);
    
        p.Publish(u);
        library.UpdateDocumentCache(p.Id);
    
        ...
    }
    

    Obviously, putting this in production code scares me.

    Is this just an issue with the size of my site?  I have about 7,000 published nodes and I'm attempting to integrate the forum into that. 

Please Sign in or register to post replies

Write your reply to:

Draft