Hang/Deadlock in CoreGeoView.Pulse

1289
4
06-26-2020 03:12 PM
MattRickard
New Contributor II

I am occasionally getting a deadlock in CoreGeoView.Pulse.

I am using 100.7 currently.

My map has about 100 FeatureLayers from an mmpk.

I do have multiple maps within the same application as well.

If my code does something at just the wrong time, it hangs.

Here are the activities I am doing that may cause it:

  • Add/Remove Layers
  • SetViewpoint
    • We are calling this frequently, using our own navigation mechanism.
  • Set Feature Visibility on certain FeatureLayers

Are there any known issues with CoreGeoView.Pulse getting stuck for an extended period of time, or getting interrupted and deadlocking?

Is there any status I can check to see if the map is ready.

We are checking for MapView.Loaded, Map.LoadStatus.

We also tried to monitor DrawStatus, but delaying activity until the map is fully drawn isn't the best user experience.

0 Kudos
4 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

An initial call stack ending in Geoview.Pulse means something interrupted the drawing but could be caused by a variety of things. You can get more information by enabling native debugging and referencing the symbols as documented here: Debug using ArcGIS Runtime Windows symbol files—ArcGIS Runtime SDK for .NET | ArcGIS for Developers.

A couple of questions:

- Are you able to reproduce with 100.8?

We made a specific enhancement in the 100.8 release for applications with multiple maps/mapviews.

- What is your application `Platform target`? (x86 | x64 | AnyCPU + Prefer 32-bit | AnyCPU)

100 feature layers is a significant number of layers to be loading concurrently. Because you also mentioned multiple maps/mapviews it's worth checking whether your application is hitting the memory limit for its specific architecture (if it's x86 then that's approx. 1.2GB or less). 

Thanks

Mike

0 Kudos
MattRickard
New Contributor II

Thank you for the debugging information.  I'll give that a try.

Our application is x64.

At this point, it seems more timing related than memory, but I'll keep that in mind.

I can't answer your question about 100.8 just yet.

We updated to 100.8, but noticed a degradation in visual quality, so we immediately reverted.

I wasn't too involved in that process, so I don't have details about the issue with 100.8.

0 Kudos
MattRickard
New Contributor II

Here are the callstacks for the 3 threads that appear to be deadlocked.

Memory usage for my whole app is 628MB.

WorkerThread 1 is doing a layer updated.

WorkerThread 2 is doing the GeoView.Pulse.

The main thread is also waiting when attempting to get the current viewpoint.

Main Thread:
ntdll.dll!NtWaitForAlertByThreadId () Unknown
ntdll.dll!RtlAcquireSRWLockExclusive() Unknown
msvcp140.dll!mtx_do_lock(_Mtx_internal_imp_t * mtx, const xtime * target) Line 105 C++
runtimecore.dll!Esri_runtimecore::Map_renderer::Map::query_extent(class Esri_runtimecore::Geometry::Envelope_2D &) Unknown
runtimecore.dll!Esri_runtimecore::Geo_views::Map_view::viewpoint(enum Esri_runtimecore::Geo_model::Viewpoint_type) Unknown
runtimecore.dll!RT_GeoView_getCurrentViewpoint () Unknown
RuntimeCoreNet.dll!CoreRT_GeoView_getCurrentViewpoint () Unknown
[Managed to Native Transition]
Esri.ArcGISRuntime.dll!RuntimeCoreNet.GeneratedWrappers.CoreGeoView.GetCurrentViewpoint(RuntimeCoreNet.GeneratedWrappers.CoreViewpointType viewpointType) Unknown
Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.UI.Controls.GeoView.ArrangeViewOverlays.AnonymousMethod__218_0() Unknown
Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.UI.Controls.MapView.OnRaiseViewpointChanged() Unknown

Worker Thread 1:

> ntdll.dll!NtWaitForAlertByThreadId () Unknown
ntdll.dll!RtlAcquireSRWLockExclusive() Unknown
msvcp140.dll!mtx_do_lock(_Mtx_internal_imp_t * mtx, const xtime * target) Line 105 C++
runtimecore.dll!Esri_runtimecore::Map_renderer::Map::Layer_manager::insert_layer_drawable_(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Layer> const &,class std::shared_ptr<class Esri_runtimecore::Map_renderer::Layer> const &,int) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Map::Layer_manager::insert_layer(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Layer> const &,struct Esri_runtimecore::Map_renderer::Layer_info const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Map::insert_layer(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Layer> const &,struct Esri_runtimecore::Map_renderer::Layer_info const &) Unknown
runtimecore.dll!Esri_runtimecore::Geo_views::Geo_view::layer_container_insert_(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Layer> const &,struct Esri_runtimecore::Map_renderer::Layer_info const &,class Esri_runtimecore::Common::Visitor_ptr<class Esri_runtimecore::Geo_model::Group_layer> const &) Unknown
runtimecore.dll!Esri_runtimecore::Geo_views::Geo_view::layer_updated_(class Esri_runtimecore::Common::Visitor_ptr<class Esri_runtimecore::Geo_model::Layer> const &,enum Esri_runtimecore::Geo_views::Geo_view::Collection_type,class std::vector<class Esri_runtimecore::Geo_views::Layer_info,class std::allocator<class Esri_runtimecore::Geo_views::Layer_info> > *,class Esri_runtimecore::Common::Visitor_ptr<class Esri_runtimecore::Geo_model::Group_layer>) Unknown
runtimecore.dll!<lambda>(void)() Unknown
runtimecore.dll!std::_Func_impl_no_alloc<<lambda_23d350ddfca9531044d43a119b81b3d3>,boost::any>::_Do_call() Unknown
runtimecore.dll!<lambda>(void)() Unknown
runtimecore.dll!std::_Func_impl_no_alloc<<lambda>(void),boost::any>::_Do_call() Unknown
runtimecore.dll!pplx::task<boost::any>::_InitialTaskHandle<boost::any,<lambda>(void),pplx::details::_TypeSelectorNoAsync>::_Init() Unknown
runtimecore.dll!pplx::details::_PPLTaskHandle<boost::any,pplx::task<boost::any>::_InitialTaskHandle<boost::any,<lambda>(void),pplx::details::_TypeSelectorNoAsync>,pplx::details::_TaskProcHandle>::invoke() Unknown
runtimecore.dll!pplx::details::_TaskProcHandle::_RunChoreBridge(void *) Unknown
runtimecore.dll!Esri_runtimecore::Common::Core_scheduler::Queued_proc::invoke(void) Unknown
runtimecore.dll!Esri_runtimecore::Common::Core_scheduler::bridge_proc_(void *) Unknown
runtimecore.dll!Esri_runtimecore::Common::Core_scheduler::Queued_proc::invoke(void) Unknown
runtimecore.dll!Esri_runtimecore::Common::Core_scheduler::bridge_proc_(void *) Unknown
runtimecore.dll!Esri_runtimecore::Common::Windows_Threadpool_scheduler::Scheduler_param::work_callback(struct _TP_CALLBACK_INSTANCE *,void *,struct _TP_WORK *) Unknown
ntdll.dll!TppWorkpExecuteCallback() Unknown
ntdll.dll!TppWorkerThread() Unknown
kernel32.dll!BaseThreadInitThunk () Unknown
ntdll.dll!RtlUserThreadStart () Unknown

Worker Thread 2:
ntdll.dll!NtWaitForAlertByThreadId () Unknown
ntdll.dll!RtlAcquireSRWLockExclusive() Unknown
msvcp140.dll!mtx_do_lock(_Mtx_internal_imp_t * mtx, const xtime * target) Line 105 C++
> runtimecore.dll!Esri_runtimecore::Map_renderer::Map::copy_display_properties(void) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Canvas_layer::get_display_properties_(void) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Canvas_layer::update(class Esri_runtimecore::Geometry::Envelope_2D const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Static_vector_layer::handle_data_changes_(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Display_properties> const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Static_vector_layer::prepare_(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Display_properties> const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Canvas_drawable::prepare_(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Display_properties> const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Canvas_drawable::prepare(class std::shared_ptr<class Esri_runtimecore::Map_renderer::Drawable::Render_properties> &,class std::shared_ptr<class Esri_runtimecore::Map_renderer::Display_properties> const &) Unknown
runtimecore.dll!Esri_runtimecore::Map_renderer::Map::on_pulse_(void) Unknown
runtimecore.dll!Esri_runtimecore::Geo_views::Map_view::pulse(void) Unknown
runtimecore.dll!RT_GeoView_pulse () Unknown
RuntimeCoreNet.dll!CoreRT_GeoView_pulse () Unknown
[Managed to Native Transition]
Esri.ArcGISRuntime.dll!RuntimeCoreNet.GeneratedWrappers.CoreGeoView.Pulse() Unknown
Esri.ArcGISRuntime.dll!Esri.ArcGISRuntime.Internal.HostedSurfaceElement.CompositionTarget_Rendering(object sender, System.EventArgs e) Unknown
PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget) Unknown
PresentationCore.dll!System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(object resizedCompositionTarget) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown

0 Kudos
MattRickard
New Contributor II

Upgrading to 100.8 seems to have helped quite a bit.

I also rearranged my code to not rapidly:

  • add layers
  • set viewpoint
  • set Feature visibility

I'll submit another question about the visual quality issues I am seeing.

Thanks for the help.

0 Kudos