Timeout if it takes time to retrive data from database.

  1. #1

    Timeout if it takes time to retrive data from database.

    We are using Ext.Net version 1.3 . There is a AjaxRequestExeception with in Listner in our master to handle any unhandle exception occur in

    our application.

    The issue is, we are calling SQL store procedure which has some manipulation and takes time. Earlier it get complete within 30 sec and application runs fine. But now the store procedure is taking time more than 30 sec (45 sec) to return data and we get AjaxrequestException.

    We are assuming ajax request has time out because of that it happen. If we reduce the data and procedure return the data with 30 sec then app runs fine. Both application and database is on same server.
    Code which is giving error is

    <ext:ResourceManager ID="ResourceManager1" runat="server" ShowWarningOnAjaxFailure="false" Theme="Slate">
    
    <Listeners>
    
    <AjaxRequestException Handler="
    Ext.Msg.alert('Alert','The server can not process the request because the selected data is too large for the server to handle.Please choose less data.');" />
    
    </Listeners>
    
    </ext:ResourceManager>
    we want to know if there is way we can increase the time out of retriving data from database so that app should wait for more time for retrieving the data and dont give error.
    Last edited by Daniil; Dec 28, 2015 at 2:20 PM. Reason: Please use [CODE] tags
  2. #2
    Hello @RahulAgarwal22, and welcome to Ext.NET forums!

    Adjust the timeout allowed for that direct method call. You can do this per method level following the instructions here:

    Timeout and DirectMethod

    Remember, the forums search (both with internal forum tools or thru google) is your friend!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    RE: Timeout if it takes time to retrieve data from database.

    Hello fabricio,

    Thank you. It was great help. :)

    Instead of [DirectMethod(Timeout = 60000)], I have used Timeout in <Click/> tag with in <DirectEvents/> and its working perfectly fine now.

     <ext:Button runat="server" Text="DD">
             <DirectEvents>
                   <Click OnEvent="Button1_Click"  Timeout = "600000"/>
           </DirectEvents>
     </ext:Button>
    Because of that we have one more issue.

    "we have used multiple button in multiple forms. To overcome from timeout issue, we have to add timeout attribute in each of <Click/> tag. This is very tedious task and chance of error is high."

    Is there any way, instead of adding multiple Timeout attribute, Can we add something in web.config or in individual page level to overcome from timeout issue?


    Regards,
    Shivam.
    Last edited by fabricio.murta; Jan 04, 2016 at 2:56 PM. Reason: add tags to code in post
  4. #4
    There are several threads about this same question already in forums, so I will just point you to one of these, which looks the most clear one:

    Problem setting DirectMethod/Event Timeout

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5

    RE: Timeout if it takes time to retrieve data from database.

    Thank you fabricio,

    We have got another issue. We have 3490 record in our database having 50 column. When we read 150-200 records application run fine but when we read all record 3490. It is showing Transaction Aborted Messaged with Status Code : - 1.

    Also, we have found if all operation get complete in 30 Sec, all running fine if it make more than 30 sec it show transaction aborted message.

    To overcome from this, We have introduced Timeout property having value Timeout = "600000". But it slow overall application.

    For Reference we have used : http://forums.ext.net/showthread.php...action-aborted

    Any suggestion?
  6. #6
    Thanks again!

    All the suggestion were really helpful and we have made a good progress in fixing our issues. But there is an issue with the <Listeners> timeout which we are not able to fix.

    We have tried multiple suggestion on the forum but non of them worked. Below is the code snippet where we are getting transaction aborted error exactly after 30 sec which we suppose is the default timeout value for a Listener. Actually on the button click we are calling a JavaScript function which takes more then 30 sec to complete the process.


    <ext:Button ID="BtnSave" Text="Save" Hidden="true" Icon="Disk" runat="server">
    <Listeners>
    <Click AutoDataBind="true" Handler="#{DirectMethods}.SaveDetails();" />
    </Listeners>
    </ext:Button>

    Please suggest an approach to increase the timeout for <Listeners> on control/page or application level. Any help will be much appreciated.

    Thank in advance!

    Rahul
  7. #7
    Hello @RahulAgarwal22

    Can you wrap code blocks you post on forums with [code] tags from now on, please? It makes code much more clear. I advise you reading our forum posting guidelines:
    - Forum Guidelines For Posting New Topics
    - More information required

    Lecture aside :) I don't really understand why you still having problems with timeout after following the tips on the related forum threads. Actually I just wrote your button and a long-running task with the suggestion on the forum post I've provided in the first post, and I get the expected behavior.

    In the example above, I will disable the button on click and when the direct method finishes, it will be sending a command to re-enable the button. So the button will only get enabled if the method finishes successfully.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="60458_longRunningDM.aspx.cs" Inherits="ExtNetPlayground_v1._60458_longRunningDM" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script runat="server">
            [DirectMethod]
            public void SaveDetails()
            {
                System.Threading.Thread.Sleep(45000); // sleep for 45 seconds "saving"
                X.AddScript("BtnSave.enable();");
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <ext:ResourceManager runat="server" />
    
                <script type="text/javascript">
                    Ext.onReady(function () {
                        Ext.Ajax.timeout = 50000; // 50 sec
                        Ext.net.DirectEvent.timeout = 50000; // 50 sec
                    });
                </script>
    
                <ext:Button ID="BtnSave" Text="Save" Hidden="false" Icon="Disk" runat="server">
                    <Listeners>
                        <Click AutoDataBind="true" Handler="BtnSave.disable(); #{DirectMethods}.SaveDetails();" />
                    </Listeners>
                </ext:Button>
            </div>
        </form>
    </body>
    </html>
    I changed the button so it do not start hidden. As only component in page, it would be pointless the example otherwise.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Apr 14, 2014, 3:37 AM
  2. [CLOSED] GridPanel Rendering takes time
    By RajivDutt in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Dec 11, 2013, 10:07 PM
  3. retrieve data from database using jsf
    By Rukia in forum 1.x Help
    Replies: 0
    Last Post: Jun 02, 2011, 10:38 PM
  4. how to add date and time to the database
    By harshad.jadhav in forum 1.x Help
    Replies: 2
    Last Post: Dec 22, 2010, 10:37 PM
  5. Json reader not retrive all pages of data in grid panel
    By Satyanarayana murthy in forum 1.x Help
    Replies: 0
    Last Post: Dec 05, 2009, 4:58 AM

Posting Permissions