Postgis repository crashes

Description

Hi,

It happened several times to get a crash when opening a postgis database (click on the black arrow). Layers begin to be listed and at one point, crash occurs. It might be easy to reproduce it happens to me one in two or three.

Olivier .

Environment

None

Activity

Show:
Olivier Leprêtre
January 14, 2017, 6:25 PM

To be more precise :

It happens when opening repository (black arrow), only when it is loaded (add new connection or start and open an existing connection)

JIT debugger returns "Unhandled exception at 0x741546a9 (msvcr120.dll) in MapWindow.exe: 0xC0000409: 0xc0000409."

And stops there

#if defined (_CRT_APP) || defined (_M_ARM)
__fastfail(FAST_FAIL_INVALID_ARG);
#else /* defined (_CRT_APP) || defined (_M_ARM) */
if (IsProcessorFeaturePresent(PF_FASTFAIL_AVAILABLE))

  • __fastfail(FAST_FAIL_INVALID_ARG);

  • /* Raise a failfast exception and terminate the process */
    _call_reportfault(_CRT_DEBUGGER_INVALIDPARAMETER,
    STATUS_INVALID_CRUNTIME_PARAMETER,
    EXCEPTION_NONCONTINUABLE);

__crtTerminateProcess(STATUS_INVALID_CRUNTIME_PARAMETER);
#endif /* defined (_CRT_APP) || defined (_M_ARM) */

Paul Meems
June 19, 2017, 10:33 AM

I've been trying to debug this issue all morning. In debug-mode I hardly ever get the error but when I try in release-mode I get it almost all the time.
In debug-mode I've added a lot of debug logging, letting me believe it might have something to do with timing.
When I disable all logging in debug-mode I also get the error everytime.

Reading a bit more about the SynchronizationContext which is used to get the layers and add them to the treeview I read two commands are available Post and Send.
Currently Post is used which means

You don't wait the Post, you only hopes that it will deliver your message

When I change this Post into Send in MW5.Data.Repository.DatabaseItem.AddLayerNode() the layers don't appear one by one anymore in the treeview but all at once at the end. But more important I don't get the crash anymore.

I'll commit my changes and this needs to be tested.

Assignee

Paul Meems

Reporter

Olivier Leprêtre

Labels

Epic Link

Affects versions

Priority

High
Configure