WebGrid running in web farm: data lost

7 replies. Last post: August 11, 2011 6:13 AM by Riendy Setiadi
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Eric Member
We are using WebGrid 6.0.7200.220 (framework 3.0.5000.771) with .NET 2.0 and just moved our application to a web farm without stickyness. Session state is stored in SQL-Server and the standard settings are all made (sharing machine key etc) All usual functions work.

But we have a problem with one of the WebGrids. I could trace it down to the following:

In the event grid.InitializePostBack I get a data ID with

ID = Request.Form("ID")

then I get the sender webgrid:

Dim gr As WebGrid = CType(sender, WebGrid)

and filter the data:

Dim FilteredSenderRows As DataRow() = CType(gr.DataSource, DataTable).Select("ID='" & ID & "'")

Then I continue only if

If FilteredSenderRows.Length = 1 Then
...
Else
'(throw error)
End If

but this sometimes throws an error. According to the HTTP log, the error only happens if the request goes to another server (compared to the previous call which fills the table).

I cannot send you a complete example for reproduction, because no bigger code changes are possible. Please see support thread [IS-5D86A204-3663-4A01-B709-2342F10A6A49] for details. It took months with the great help of your support engineer Dicky (in 2009) to get this page working, so we cannot change everything again.

This all works fine when running in a single-IIS configuration. It is just causing problems with the web farm.

Is the WebGrid caching the data somewhere else besides Session and ViewState local on one of the servers? What can be done to avoid this problem?

Thanks,

Eric

Eric Member

Hi Riendi,

Back from vacation now. Yes, I do know the information in that article. We've set the machine key in the web.config and use session state on SQL-Server.

Eric

Eric Member

Hi Riendy,

Thanks for your reply. I found the documentation of the AllowAutoDataCaching property. From the documentation it does a caching of the DataSource object and is enabled per default. As all grids we use get refreshed with different data on every click, we might change this to False everywhere anyway.

But from the description it also says that the caching feature is not being used automatically and instead we should use IsDataCached property before querying for new data. We are not doing that, so I assume we don't use the caching feature anyway. Also, the description says the cached data is stored in the Session object and that is stored in SQL-Server session handler database, so it's not webserver specific.

I'm looking for some reason why the data is only on one server and not shared or not refreshed properly. So this property would not explain the problem.

Any other ideas? Any known bugs?

Regards,

Eric

Hello Eric,


First of all, I'm sorry for the latest respones.
After had a discussion with a developer, you should set AllowAutoDataCaching property to false as you did to disallow auto data caching.
If it is run not as expected, please ensure that you have called a dataSource in a right pattern. You have call a DataSource in OnInitializeDataSource WebGrid's event. 

Please let me know if you have put it in the right state and it still not working.


Regards.
Riendy

Eric Member
Hi Riendy,

The problem on the web farm is now gone, but the application is not working anymore.

On that page we have two grids. The main WebGrid is hierarchical with dynamic loading of subnodes. We are using the recommended way (see the other thread) to load the data in InitializeDataSource. When opening a node, dynamically the data in that node will get loaded. In InitializeSelfReferenceDataSource I call e.ParentKeyValues to get the parent value and load the node data and merge it into e.DataSource with .Merge(ds.Tables(0), True, MissingSchemaAction.Error).

After turning off this AllowAutoDataCaching feature, I noticed two new problems:

a) Opening the first level nodes works, but any level deeper does not work. In InitializeSelfReferenceDataSource the data seems to get added correctly, but it just doesn't get displayed. I'm still debugging this.

b) When selecting and row in a subnode and then clicking on a row in the second WebGrid, a client-side js event gets called, which posts back by calling grdMain.SendCustomRequest. On the server-side this goes into the wg2.InitializePostBack event. There I access what was selected in the first grid: CType(grdMain.DataSource, DataTable).Select("ID="...). The problem is now that the data isn't there anymore, the row is missing. When a row in the root is being selected it works, but not if a row is selected which was added by InitializeSelfReferenceDataSource event. Before turning off the AutoCache it worked.

The problem b) is only for the server-side, on the client the folders are all there and nothing disappears. Do I have to cache this data myself somehow? Or what is the idea here?

Regards,

Eric

Hi Eric,

I could replicate your issue (a) on my simple sample. This issue appears only when call a data in server side. I have forwarded this issue to our development team.

For the second issue (b), it is on investigating now. Please let me know if there is another information for these issues.

I will let you know for the updates soon.


Thank you.
Riendy

All times are GMT -5. The time now is 3:58 PM.
Previous Next