The Wayback Machine - https://web.archive.org/web/20200914065511/http://github.com/microsoft/Win2D/issues/522
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible leak using Win2D inside a PivotItem #522

Open
adrianhescalante opened this issue May 15, 2017 · 8 comments
Open

Possible leak using Win2D inside a PivotItem #522

adrianhescalante opened this issue May 15, 2017 · 8 comments
Labels

Comments

@adrianhescalante
Copy link

@adrianhescalante adrianhescalante commented May 15, 2017

I think I have found an issue related to Win2D. This a sample project to test it.
The steps to reproduce are:

  • Execute the app.
  • Scroll to the second PivotItem.
  • Wait a little until the app crashes.

It only happens when you scroll to the second item, until that moment the memory profiling shows good readings. I tried to investigate it, but the fault is in native memory and the symbols don't seem to work. What do you think?

Thanks in advance!

Note: You need to test it with a device with compass.

@shawnhar shawnhar added the question label May 15, 2017
@shawnhar
Copy link
Member

@shawnhar shawnhar commented May 15, 2017

I'm curious what do you see to make you think this is a leak issue? (your bug title and the repro project name mention a leak, but I don't see in the repro steps where the leak part comes in...)

Looking at your repro code, my first guess is maybe your compass change handler is calling Invalidate on the CanvasControl after that CanvasControl has been unloaded? (due to scrolling away from it in the pivot view)

Enabling mixed mode (or native) debugging in your Visual Studio project debug settings may give more useful information like a full crash callstack.

@adrianhescalante
Copy link
Author

@adrianhescalante adrianhescalante commented May 15, 2017

Sorry, that is not my real project, it's one I created to test this issue. I am not sure that the problem here is Win2D, but it is what I guessed after a lot of investigating. The possible leak I refer to is that the memory keeps growing when changing to the second pivot item until crash, but it doesn't happen if I do not draw at all or I keep in the first pivot item.

I updated the project subscribing to the Loaded and Unloaded event of Canvas control and activating/deactivating the compass in those methods, but it crashes as before. As a note, the Unloaded event is not called when the pivot item changes. A possible fix from my side is to stop manually the invalidates when the Pivot Selected event is fired, but it's weird that the app crashes if I don't. You can test this with an device/emulator with the compass enabled.

This is the callstack I managed to get from a dump:

Cannot read PEB32 from WOW64 TEB32 ffffffff - HRESULT 0x80004002
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(1120.4e4): Unknown exception - code c000027b (first/second chance not available)
*** ERROR: Symbol file could not be found. Defaulted to export symbols for KERNELBASE.dll -
KERNELBASE!RaiseFailFastException+0x60:
7705d750 4b26 ldr r3,=KERNELBASE!_jump_unwind+0x234e (7707b55e) 7705d7ec=7707b55e ; [KERNELBASE!RaiseFailFastException+0xfc (7705d7ec)]
0:006> k
Child-SP RetAddr Call Site
00 04b6f218 77329590 KERNELBASE!RaiseFailFastException+0x60
*** ERROR: Symbol file could not be found. Defaulted to export symbols for combase.dll -
01 04b6f440 68b95024 combase!RoFailFastWithErrorContextInternal2+0x1a0
*** ERROR: Symbol file could not be found. Defaulted to export symbols for Windows.UI.Xaml.dll -
02 04b6f5d8 68b94cda Windows_UI_Xaml!GetStringRawBuffer+0x2b4f4
03 04b6f610 68b94b4c Windows_UI_Xaml!GetStringRawBuffer+0x2b1aa
04 04b6f668 753aa510 Windows_UI_Xaml!GetStringRawBuffer+0x2b01c
*** ERROR: Symbol file could not be found. Defaulted to export symbols for twinapi.appcore.dll -
05 04b6f680 753aa552 twinapi_appcore!PsmIsProcessInApplication+0x238c0
06 04b6f6a0 753a0080 twinapi_appcore!PsmIsProcessInApplication+0x23902
07 04b6f6b8 7539f9f2 twinapi_appcore!PsmIsProcessInApplication+0x19430
08 04b6f6f0 753a6514 twinapi_appcore!PsmIsProcessInApplication+0x18da2
09 04b6f720 753a6596 twinapi_appcore!PsmIsProcessInApplication+0x1f8c4
0a 04b6f748 7732905a twinapi_appcore!PsmIsProcessInApplication+0x1f946
0b 04b6f760 77329b58 combase!WindowsTrimStringStart+0x1ea
0c 04b6f7a8 68b95182 combase!RoReportUnhandledError+0x18
0d 04b6f7b8 687b08be Windows_UI_Xaml!GetStringRawBuffer+0x2b652
0e 04b6f818 687b06c4 Windows_UI_Xaml+0x4108be
0f 04b6f878 686f9900 Windows_UI_Xaml+0x4106c4
10 04b6f890 6894abf2 Windows_UI_Xaml+0x359900
11 04b6f8b0 68798f98 Windows_UI_Xaml!DllGetActivationFactory+0x17dd2
12 04b6f900 68795a4e Windows_UI_Xaml+0x3f8f98
13 04b6fa28 6879590c Windows_UI_Xaml+0x3f5a4e
14 04b6fa60 687957aa Windows_UI_Xaml+0x3f590c
15 04b6fa80 6879560a Windows_UI_Xaml+0x3f57aa
16 04b6fad8 68795580 Windows_UI_Xaml+0x3f560a
17 04b6fb08 688907aa Windows_UI_Xaml+0x3f5580
18 04b6fb48 76cfe818 Windows_UI_Xaml+0x4f07aa
*** ERROR: Symbol file could not be found. Defaulted to export symbols for minuser.dll -
19 04b6fb90 76cfa45e minuser!PeekMessageW+0x2b58
1a 04b6fbf0 76cf95de minuser!InSendMessageEx+0xace
1b 04b6fca0 6d53b790 minuser!DispatchMessageW+0x17e
*** ERROR: Symbol file could not be found. Defaulted to export symbols for Windows.UI.dll -
1c 04b6fd18 6d539ce4 Windows_UI!DllGetClassObject+0x6f20
1d 04b6fd78 6d53b690 Windows_UI!DllGetClassObject+0x5474
1e 04b6fe08 689a1a4c Windows_UI!DllGetClassObject+0x6e20
1f 04b6fe70 689a1a00 Windows_UI_Xaml!DllGetActivationFactory+0x6ec2c
20 04b6fe90 689a18a2 Windows_UI_Xaml!DllGetActivationFactory+0x6ebe0
21 04b6fec0 753777ae Windows_UI_Xaml!DllGetActivationFactory+0x6ea82
22 04b6fef0 753b2f92 twinapi_appcore!Ordinal6+0x4efe
23 04b6ff00 75848ef6 twinapi_appcore!PsmIsProcessInApplication+0x2c342
*** ERROR: Symbol file could not be found. Defaulted to export symbols for shcore.dll -
24 04b6ff40 7741da22 shcore!SHCreateThread+0x206
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
25 04b6ffd8 00000000 ntdll!RtlUserThreadStart+0x22

As you can see, sadly, no so much information or at least, I don't understand it. The symbols are being downloaded from Microsoft servers, but it seems it doesn't find them.

I hope you can point me in the right direction and I apologize if I didn't explained well at the beginning.

Thanks!

@shawnhar
Copy link
Member

@shawnhar shawnhar commented May 16, 2017

I ran your test app and switched back and forth between the two pivots a bunch of times without seeing any crash or memory increase. What else do I need to do to reproduce the problem?

@shawnhar shawnhar added need info and removed question labels May 16, 2017
@adrianhescalante
Copy link
Author

@adrianhescalante adrianhescalante commented May 17, 2017

Did you test it with a device with compass enabled? Like a real device or a mobile emulator? If not, the method OnCompassReadingChanged that executes the invalidate is not being called.

@shawnhar
Copy link
Member

@shawnhar shawnhar commented May 18, 2017

I tried in the emulator but did not see any crash.

@adrianhescalante
Copy link
Author

@adrianhescalante adrianhescalante commented May 18, 2017

I don't understand... For me it's a 100% crash ratio when I keep the app in the second pivot item and the OnCompassReadingChanged method is being called. The emulator I am using is "Mobile Emulator 10.0.14393.0 WVGA 4 inch 512MB" and has the compass enabled in its options, although I tested even with the 3GB one and the crash happens, only after a little more time than the 512 version. When executing it with target "Local machine" the crash doesn't happen because my computer it has no compass an that method is not being called, which makes sense.

What can be the difference? I will record a video in case you cannot reproduce it to show the crash so you can see I am not inventing things 😆

@xiedongweo
Copy link

@xiedongweo xiedongweo commented May 19, 2017

I also can reproduce it. @shawnhar

@shawnhar
Copy link
Member

@shawnhar shawnhar commented May 22, 2017

I don't know why I'm not seeing the same thing you are.

Can you avoid this by not invalidating the control while it is not visible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.