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

Crash at relaunch in pythonlib in SDL2Thread #1787

Closed
brvier opened this issue Apr 5, 2019 · 9 comments
Closed

Crash at relaunch in pythonlib in SDL2Thread #1787

brvier opened this issue Apr 5, 2019 · 9 comments

Comments

@brvier
Copy link
Contributor

brvier commented Apr 5, 2019

Versions

  • Python: 2.7
  • OS: Android Oreo
  • Kivy: master
  • Cython: last prerered version 27.3

Description

Swipe app from task list invoke onDestroy in SDLActivity.java

    // Now wait for the SDL thread to quit
    if (SDLActivity.mSDLThread != null) {
        try {
            SDLActivity.mSDLThread.join();
        } catch(Exception e) {
            Log.v(TAG, "Problem stopping thread: " + e);
        }
        SDLActivity.mSDLThread = null;

        //Log.v(TAG, "Finished waiting for SDL thread");
    }

    super.onDestroy();

    // Reset everything in case the user re opens the app
    SDLActivity.initialize();

But it s look like a thread never ends in my app or invoking service prevent activity to be deleted, so at relaunch the app crash with SDL2Thread in libpython

If i do a Process.killProcess(Process.myPid()); second launch don't crash....

I think all my threads should be ended, could it be a Clock.schedule_interval ?

@ghost
Copy link

ghost commented Apr 5, 2019

If the thread keeps running and it's related to Clock.schedule_interval, is this possibly a kivy issue?

@brvier
Copy link
Contributor Author

brvier commented Apr 5, 2019

Not sure which thread is running and why for the moment
But same code didnt cause any problem on iOS nor Linux

@ghost
Copy link

ghost commented Apr 5, 2019

For what it's worth, I don't use kivy but I make very heavy use of threading, and I've never seen this happen. Of course it could still be a python-for-android issue, but it might be worth investigating kivy as well

Maybe add another thread and have it do this every few seconds? https://stackoverflow.com/questions/1032813/dump-stacktraces-of-all-active-threads Of course that will also break your shutdown but then at least you should see in the log what sort of threads are still running, if any

@brvier
Copy link
Contributor Author

brvier commented Apr 5, 2019

Or just my code ...

@inclement
Copy link
Member

Just to be clear, Clock.schedule_interval does not involve threading. I'm not sure what is causing this problem.

@ghost
Copy link

ghost commented Apr 29, 2019

@inclement for what it's worth SDL2 2.0.9 stable has a remaining concurrency bug that can in theory cause crashes, but with the SDL2 dev version and even SDL_ANDROID_BLOCK_ON_PAUSE disabled (which makes everything a little more off the rails parallel) I haven't had any crashes or corruption with my app for weeks. I don't use kivy though, but at least as far as python-for-android is concerned it looks to me like it's possibly working corruption free (finally!) at least with latest SDL2 dev

@inclement
Copy link
Member

@Jonast Thanks, I'm currently testing your SDL2 update PR with kivy

@ghost
Copy link

ghost commented Jun 26, 2019

Is this still an issue? Has there been anything new you found out @brvier ?

@ghost ghost added the awaiting-reply label Jun 26, 2019
@brvier
Copy link
Contributor Author

brvier commented May 19, 2021

Too old

@brvier brvier closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants