Timeout Exception?

5 posts, 1 answers
  1. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 22 Oct 2013 Link to this post

    Hello, I am making an application for work that involves using an OData service.

    I am using the RadDataServiceDataSource control in conjunction with the RadDataFilter to manage data from the OData service such that the user can get the information they need without actually having to know how to compose an OData query string (the data is presented in a RadGridView).

    The problem I am running into occurs when there are few to no filters in the query string (which are provided via the RadDataFilter on the UI). I appear to be getting a timeout exception, the following is a relevant line from the response message from the service: 

    "Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding."

    I have confirmed that the server is indeed responding and I have tried increasing the timeout on both the service directly and also on the RadDataServiceDataSource object in the XAML. Unfortunately this seems to have no effect at all. Whether an exception gets thrown or the operation is successful the service spins for the same amount of time. 

    After a few hours on Google I found some folk who suggested that the following line that is added to the OData query string by default could be the culprit:

    inlinecount=allpages

    I cannot confirm whether or not this is true, but from what I understand this line adds an extra call to the database that grabs the count of how many rows will be returned when the query string is executed. The problem (in theory) is that even though I have set the PageSize property of the RadDataFilter to only be 1000 (to avoid things like timeout problems and overly large result sets) this first call to grab the count ignores that limiter. If this is indeed true then all I would need to do is change allPages to none in said line at the end of the OData query string. 

    I have looked at all of the properties of the service context, RadDataServiceDataSource, and RadDataFilterThe but nothing is sticking out as a way to accomplish this. I have also tried hooking into the loading event of the RadDataServiceDataSource and editing the query string before it is sent but I cannot find a way to change the request URI (as it is read only at this point).

    Any advice on how to remedy this situation?

    Note: Code/XAML/Full Exception Details were omitted for neatness sake. If you would like to see them I can add those.

    Thank you in advance for any help on this matter

  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 23 Oct 2013 Link to this post

    Hi,

    We always add the inlinecount when going to the server since we need to know the total amount of pages. I guess you are talking about RadDataPager when mentioning PageSize, since RadDataFilter does not have a PageSize. If you wire RadDataPager and RadDataServiceDataSource, the first trip to the server will only fetch PageSize of records and not all of them.

    I have prepared a sample project which demonstaretes this. When you run the project you will see all OData queries sent to the server in the box below the grid. Alternatively, you can use Fiddler to debug the web trafic. Run the project and you will see something like this:

    --> Requesting http://localhost:55555/Services/NorthwindService/Customers()?$top=10&$inlinecount=allpages
    <-- Server replied in 699 ms

    As you see from this query, if PageSize is 10 we will add $top=10. We always add $inlinecount=allpages to get the number of all records.


    In case you think that our component has some kind of a problem, please modify my sample project so it does exhibit the problem. Without being able to debug something I cannot really tell what is happening on your end.


    Regards,
    Rossen Hristov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 23 Oct 2013 Link to this post

    Hi, 

    Thank you for the great reply!

    Sorry for the typo, I was referring to the page size property on the RadDataServiceDataSource

    I took a look at the sample project you provided. I hadn't previously used the RadDataPager so I gave it a shot. It was a nice touch but ultimately does not solve my problem, however; I did notice that regardless of the page size I chose (even some as small as 5 or 10) the service always times out if you provide no filters in the query string (which means it would just be a query that should grab the top 10 items from the table/view). 

    I am still confused as to why changing the Timeout property on the RadDataServiceDataSource does not affect how long the service spins for. As I understand it, the value given to that property is in seconds, I have tried everything from 5-5000 as values and the call (on average) always takes the same amount of time. 

    Given the situation described above and the fact that the inlinecount=allpages clause is necessary I am inclined to think the problem I am running into is not directly related to the Telerik controls.

    Thank you for all the help,
    Marc
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 24 Oct 2013 Link to this post

    Hi,

    RadDataServiceDataSource does not have a Timeout property. So I am not sure how you are setting it. It is your DataServiceContext that has such a property. And our control has nothing to do with the DataServiceContext timeout.

    Let me try to explain what this control does.

    RDSDS does absolutely nothing besides telling the DataServiceContext to load a DataServiceQuery<T> which you could easily do by hand yourself. My point is that our control is a very thin wrapper over the WCF Data Services stack -- all of the real job is actually done by the WCF Data Services stack -- we simply append Where, OrderBy, Skip and Take to the DataServiceQuery<T> and then tell the DataServiceContext to load it. Nothing more. We have only developed this controls so you don't have to read RadGridView's FilterDescriptors and convert them to Where clauses on the DataServiceQuery. Same applies for sorting and paging.

    You could easily do exactly the same without using any Telerik controls at all. Something like this:

    var query = this.context.Customers.Where(c => c.Name == "John").OrderBy(c => c.Salary).Skip(10).Take(10);

    and then tell the context to load this query. That is what our control does.

    So my point is, if you want to configure some kind of a timeout on your DataServiceContext, then go ahead and do it -- but this has nothing to do with RadDataServiceDataSource. We don't have control over your WCF Data Services Stack configuration and timeouts. They fall beyond the scope of this control which is a simply query builder and nothing more.

    Here you can learn what RadDataServiceDataSource does.

    Please, try to test the same query without using our control and you should have the same timeout problem. This is because the problem is inside the WCF Data Service layer and not on the client where our control resides.

    I hope this makes sense.

    Regards,
    Rossen Hristov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 25 Oct 2013 Link to this post

    Hi,

    That cleared everything up! Thank you for the help!
Back to Top
UI for WPF is Visual Studio 2017 Ready