New Posts New Posts RSS Feed: Weird crashes
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Weird crashes

 Post Reply Post Reply
Author
jblosser View Drop Down
Newbie
Newbie
Avatar

Joined: 30-Aug-2011
Location: United States
Posts: 3
Post Options Post Options   Quote jblosser Quote  Post ReplyReply Direct Link To This Post Topic: Weird crashes
    Posted: 31-Aug-2011 at 10:48am
Sorry for rambling a bit, I'm trying to figure out how to put my issue into words...

I'm trying to improve performance of my application a bit and have run into something really strange, perhaps someone else can help give me some insight.

I have a Silverlight app that I'm doing some dynamic queries with (so dynamic where clauses, group by, aggregate selects)

So I might have as an example:

var query = <some EntityQuery>.GroupBy(x => new { x.Foo, x.Bar }).Select(x => new { Key = x.Key, Agg = x.Sum(y => y.Baz));

But since it is all dynamic, I'm doing it with the AnonymousProjectionSelector.

Everything works fine and peachy most of the time... but here is the weird part.

If I turn off WCF SessionState (or using client HTTP stack) which allows Silverlight to run multiple queries in parallel (see here http://weblogs.asp.net/olakarlsson/archive/2010/05/20/simultaneously-calling-multiple-methods-on-a-wcf-service-from-silverlight.aspx) everything still works fine

Until I recycle the app pool.

Then I start getting this exception:
Caught exception: System.ArgumentException: Property '_IB_DLP_pW9cXja0eElRI[System.String] Key' is not defined for type '_IB_D78dbXbXUGgLyuM2[_IB_DLP_pW9cXja0eElRI[System.String],System.Nullable`1[System.Decimal]]' at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.HandleException(Exception e, PersistenceFailure failureType) at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.OnExecuteQuery() at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.Execute(IEntityQuery entityQuery, SessionBundle sessionBundle, IEntityServer entityServer) at IdeaBlade.EntityModel.Server.EntityServer.Fetch(SessionBundle sessionBundle, IEntityQuerySurrogate surrogate) at SyncInvokeFetch(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)


Any thoughts on what could possibly cause this? It seems like a strange set of circumstances, but I can't figure out why it is happening only in that one (common) scenario...
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 01-Sep-2011 at 3:30pm
Hi jblosser;

We think that it has something to do with anonymous types and dynamic LINQ queries. We're going to do some testing here to confirm this and give you an update as soon as possible.
Back to Top
jblosser View Drop Down
Newbie
Newbie
Avatar

Joined: 30-Aug-2011
Location: United States
Posts: 3
Post Options Post Options   Quote jblosser Quote  Post ReplyReply Direct Link To This Post Posted: 02-Sep-2011 at 9:33am
If it helps you any, I worked around this issue by making the Group By anonymous projection "unique" per query by giving the Group By columns an Alias with a random name (that I ended up remapping to the correct column name on the results).

So I suspect it is something to do with re-using an invalid cached Anonymous class that appears to have the same signature (but apparently doesn't for whatever reason).
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 02-Sep-2011 at 2:39pm
jblosser;

Our first suspicion was wrong. We're unable to get any exception in our testing.

Could you post some code snippets of your workaround? Perhaps, something like before and after the workaround?

Could you also post your debug log and the DevForce version that you're using?

Thanks!
Back to Top
jblosser View Drop Down
Newbie
Newbie
Avatar

Joined: 30-Aug-2011
Location: United States
Posts: 3
Post Options Post Options   Quote jblosser Quote  Post ReplyReply Direct Link To This Post Posted: 07-Sep-2011 at 9:42am
I've uploaded a test app that can duplicate the problem here:


Steps to repro:
Run the app
Set the # of requests to 15 or so
Hit start (it'll do a bunch of parallel queries)
Edit the web.config  (this should recycle the app pool)
Hit start again (should fail)

Reload the silverlight web page
Hit start (should still fail)

It can sometimes be hit-or-miss for me with this project -- so you might have to try it a few times for it to start bombing.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 08-Sep-2011 at 11:05am
Thanks for the repro sample jblosser. Please give me some time to analyze it and I'll get back to you as soon as possible.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 08-Sep-2011 at 12:15pm
You're right it was a hit and miss to get it to fail. In addition, if I recycled the app pool by using the Recycle button in the IIS Manager, or if I use BrowserHttp (Default button checked), then switch to using ClientHttp (WebClient button checked), it'll make it even harder to get the exception, sometimes to the point of never.

I discussed this with a senior engineer and we think that it's a multi-threading issue with the dynamic type resolution. We will open a bug report for this.

Thanks for the test app again.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down