This project has moved. For the latest updates, please go here.
1
Vote

Deadlock in loading data

description

My app has 2 main Models seem to easily deadlock with one another. They work very intimately to present the UI so this is a huge problem. However, I can not figure out what exactly went wrong but all signs point to deadlock in AgFx. I have tries various versions include the latest, November and April, all show the same symptoms. Please see the attached screen shots for details. There are more screen shots (stack trace for each thread involved) and good/bad trace logs for comparison:
 
Unflagged 267846818 0 Worker Thread Storage Thread AgFx.PriorityQueue.WorkerThread.WorkerThreadProc Normal 0
Unflagged 266994870 0 Worker Thread <No Name> Normal 0
Unflagged 266536050 0 Worker Thread <No Name> AgFx.WebLoadRequest.Execute.AnonymousMethod__0 Normal 0
Unflagged 262931542 0 Worker Thread <No Name> Normal 0
Unflagged 261292526 0 Worker Thread General Worker AgFx.PriorityQueue.WorkerThread.WorkerThreadProc Normal 0
Unflagged > 256967826 0 Main Thread Main Thread AgFx.CacheEntry.Value.get Normal 0
Unflagged 254280986 0 Worker Thread <No Name> AgFx.NotifyPropertyChangedBase.RaisePropertyChanged Normal 0
Unflagged 242615362 0 Worker Thread <No Name> AgFx.WebLoadRequest.Execute.AnonymousMethod__0 Normal 0
Unflagged 241041934 0 Worker Thread <No Name> WeatherLive.Weather.LocationWeather.UpdateLocationWeatherRequestCallback Normal 0
Unflagged 234882146 0 Worker Thread <No Name> Normal 0

file attachments

comments

shawnburke wrote Jan 29, 2012 at 3:07 PM

Hi. One thing I see that's different here is that in the thread list above, AgFx.CacheEntry.Value is being called from the main thread, whereas in the png, it's being called from a threadpool thread.

There's very possibly and issue here with AgFx, but maybe check if you're calling a DataManager operation from something off-thread. I've seen issues where initiating objects on the wrong thread results in AgFx not knowing that it needs to switch contexts, which leads to this kind of stuff.

Also, I just see one png, are there more?

wrote Jan 29, 2012 at 8:18 PM

laorient wrote Jan 29, 2012 at 8:18 PM

There are more. I am not sure on the thread thing. The properties using DataManager are used in bindings only so they should all be from the UI thread. I feel that it maybe a load related problem as when I started to use a local buffer variable like this:
                if (_weatherForecast == null)
                {
                    Debug.WriteLine("Getting weatherForecast for location:" + locationRegion);
                    _weatherForecast = DataManager.Current.Load<Weather.WeatherForecastModel>(locationRegion,
                    (wfm) =>
                    {
                        if (wfm != null)
                            hasWeatherForecast = true;
                        else
                            hasWeatherForecast = false;
                    },
                    (ex) =>
                    {
                        // set flag
                        hasWeatherForecast = false;
                    });
                }
                return _weatherForecast;
Then the problem seems to go away (definitely hasn't happened yet).
There are many more pngs, but they only allow one file each time. I will try to load all of them.

wrote Jan 29, 2012 at 8:19 PM

laorient wrote Jan 29, 2012 at 8:19 PM

Deadlock2

wrote Jan 29, 2012 at 8:20 PM

laorient wrote Jan 29, 2012 at 8:20 PM

Deadlock3

wrote Jan 29, 2012 at 8:21 PM

laorient wrote Jan 29, 2012 at 8:21 PM

Deadlock4

wrote Jan 29, 2012 at 8:21 PM

laorient wrote Jan 29, 2012 at 8:21 PM

Deadlock5

wrote Jan 29, 2012 at 8:22 PM

laorient wrote Jan 29, 2012 at 8:22 PM

Deadlock6.

wrote Jan 29, 2012 at 8:23 PM

laorient wrote Jan 29, 2012 at 8:23 PM

Good load log trace. This log contains parts from AgFx. I don't see anything substantially different, though, compare to the deadlock load log trace.

wrote Jan 29, 2012 at 8:23 PM

laorient wrote Jan 29, 2012 at 8:23 PM

Deadlock load log trace. The end.

wrote Feb 14, 2013 at 1:53 AM