kivy-garden / graph

Displays plots on a graph.
MIT License
50 stars 18 forks source link

LinePlot / SmoothLinePlot crashes on Kivy 1.10.0 and certain graphics hardware on windows #11

Open brentpicasso opened 7 years ago

brentpicasso commented 7 years ago

We have reports of SmoothLinePlot crashing our app when running on Windows 7 when running Intel HD 4000 drivers. Also reproduces with the latest driver version.

This started with Kivy 1.10.0 - does not reproduce on Kivy 1.9.1.

Any suggestions on how to diagnose? or graphics settings that might mitigate this?

Thanks,

brentpicasso commented 7 years ago

Looks like it's also happening with LinePlot as well. Trying to get a console output to augment this ticket.

matham commented 7 years ago

tshirtman had some graphics crashes a while back that crashed python. He fixed it by reverting some changes to graphics instructions. Here's the patch for it: https://gist.github.com/tshirtman/32c62920c05529e461561958696684e0. But we weren't able to track down the actual reason for the crash. Give it a try and maybe it fixes it.

The other consideration is that graph uses a fbo which is known to be buggy under some circumstance (e.g. when used with a stencil), so maybe disable it and see if that fixes things.

On Mon, Oct 23, 2017 at 12:10 PM, Brent Picasso notifications@github.com wrote:

Looks like it's also happening with LinePlot as well. Trying to get a console output to augment this ticket.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kivy-garden/garden.graph/issues/50#issuecomment-338711431, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkW_q06E3Ts5ftBm50_o-gymBt2Bj0oks5svLqIgaJpZM4QDEOT .

brentpicasso commented 7 years ago

Thank you; we'll give it a try and report back.

brentpicasso commented 7 years ago

any risk or side effects by doing this revert? If there's a PR or commit that describes the reason for the original code, please share it so I know if it's just a refactoring / optimization or if it fixed something important. would be helpful before we give this to our customers.

Thanks!

matham commented 7 years ago

It's this PR: https://github.com/kivy/kivy/pull/2187. The side effects is only if you're using a memory view and editing the array in place. But kivy is not using it internally I think.

On Mon, Oct 23, 2017 at 6:38 PM, Brent Picasso notifications@github.com wrote:

any risk or side effects by doing this revert? If there's a PR or commit that describes the reason for the original code, please share it so I know if it's just a refactoring / optimization or if it fixed something important. would be helpful before we give this to our customers.

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kivy-garden/garden.graph/issues/50#issuecomment-338817347, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkW_lqQJX2QPLm8UINIB29NdRPpBRwBks5svRV9gaJpZM4QDEOT .

brentpicasso commented 7 years ago

Thank you. still waiting for some log dumps. I take it the line chart exploits this feature in some way, possibly causing the crash?

Will apply the branch and see if my users reproduce the problem. It's slow for me because I cannot reproduce it locally.

matham commented 7 years ago

The charts do not use that feature. Similarly, tshirtman was not using that feature, yet a git bisect showed this commit was responsible for it. This is why it's so mysterious as there doesn't seem to be any reason for the crash. I'm guessing it's something to do with memory management in cython.

On Tue, Oct 24, 2017 at 10:43 AM, Brent Picasso notifications@github.com wrote:

Thank you. still waiting for some log dumps. I take it the line chart exploits this feature in some way, possibly causing the crash?

Will apply the branch and see if my users reproduce the problem. It's slow for me because I cannot reproduce it locally.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kivy-garden/garden.graph/issues/50#issuecomment-339014391, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkW_onviirNWgju-PufnvFU06PCmGBcks5svfeBgaJpZM4QDEOT .

brentpicasso commented 7 years ago

Thanks. I'll hold off until we can reproduce it. Hopefully we can get it fixed without me having to purchase a specific computer to test on. :)

brentpicasso commented 6 years ago

Here's the crash, right when the graph is used.

Does this ring a bell?

Exception MemoryError: MemoryError('vertex index allocation',) in 'kivy.graphic s.vbo.VertexBatch.append_data' ignored Exception MemoryError: MemoryError('vertex index allocation',) in 'kivy.graphic s.vbo.VertexBatch.append_data' ignored

image

tshirtman commented 6 years ago

I'm not sure i had any visible error before segfaulting on my side, but i don't have the logs around anymore to confirm :/

About the feature that the removed code defines, i didn't use it (at least explicitly) either, my code was just a dynamic mesh defined in kv, so aside some complex looping/zipping code, there was nothing really magic going on.

matham commented 6 years ago

I don't remember seeing this error before. Sounds like there's a memory leak and plots or data points are not released.

On Oct 30, 2017 6:08 PM, "Gabriel Pettier" notifications@github.com wrote:

I'm not sure i had any visible error before segfaulting on my side, but i don't have the logs around anymore to confirm :/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kivy-garden/garden.graph/issues/50#issuecomment-340599667, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkW_i5l_qVU6dxrtC-N3EhZcrXcizF-ks5sxkjVgaJpZM4QDEOT .

brentpicasso commented 6 years ago

So from reports, this happens the instant they navigate to the part of the app that has the graph - it's not something that happens gradually. However, I suppose an infinite loop could consume memory quickly.

As before, it appears to happen with certain video hardware - Intel HD 4000

tito commented 6 years ago

I think that in order to understand what's going on, you need to figure out if VBO are correctly deallocated. This can be checked in 2 ways:

A MemoryError really indicate that something is not freed; we have already few driver-specific fixes in the Kivy codebase, maybe this error require one as well.

brentpicasso commented 6 years ago

This problem reproduced on a specific configuration. However, this specific configuration is actually pretty common, because it is happening on Windows 7 with the Intel HD 4000 graphics, which shows up on many different computers, especially laptops.

I have recently acquired a Thinkpad T530 and I'm in the process of installing WIndows 7 on it; Fortunately I reproduced the problem with our app, so I'll be able to install the dev tools (after all of the Windows service packs are installed) and then see what I can figure out.

What I did notice from casual observation, is that the app seems to freeze for a while, then crashes - not an immediate crash. This has me guess that it is going into a loop, allocating memory until exhausted.