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

Android crash on run, Fatal signal 6 (SIGABRT), code -6 in tid 10265 (SDLThread), avc: denied { search } #1562

Closed
ApplySci opened this issue Dec 28, 2018 · 10 comments

Comments

@ApplySci
Copy link

I think this is a p4a issue rather than a kivy one or a buildozer one. I get an apk from the build process. I install it on my android device. It installs ok. It never runs successfully. The relevant bit of adb logcat pasted is below.

Versions

  • Python 3.7.1:
  • OS: Android
  • Kivy: github/master
  • Cython: 0.28.6

Description

Aborts on every run on Android 8.1

buildozer.spec

[app]
title = ZAPS Mahjong Scorer
package.name = ZAPSMahjongScorer
package.domain = es.bacchant.mahjong
source.dir = /src/src
source.exclude_dirs = images
version.regex = __version__ = ['"](.*)['"]
version.filename = %(source.dir)s/main.py
requirements = python3,kivy,sqlite3,requests,urllib3,chardet,certifi,idna,android,openssl,pyjnius
presplash.filename = %(source.dir)s/images/chipmunk.jpg
icon.filename = %(source.dir)s/images/icon1.png
orientation = portrait
osx.python_version = 3
osx.kivy_version = 1.9.1
fullscreen = 1
android.api = 27
android.minapi = 21
android.ndk = 17c
android.ndk_api = 21
android.private_storage = True
android.ndk_path = /opt/crystax-ndk-10.3.2
android.sdk_path = /opt/android/android-sdk/
p4a.branch = master
android.arch = armeabi-v7a
p4a.bootstrap = sdl2
[buildozer]
log_level = 2
warn_on_root = 1
build_dir = /home/user/build
bin_dir = /src

Logs

10240 10265 I SDL     : SDL_Android_Init()
10240 10265 I SDL     : SDL_Android_Init() finished!
10240 10265 I python  : Initializing Python for Android
10240 10265 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
10240 10265 I python  : /mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/user/0/es.bacchant.mahjong.zapsmahjongscorer/files/app
10240 10265 I python  : Preparing to initialize python
10240 10265 I python  : _python_bundle dir exists
10240 10265 I python  : calculated paths to be...
10240 10265 I python  : /mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/user/0/es.bacchant.mahjong.zapsmahjongscorer/files/app/_python_bundle/stdlib.zip:/mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/user/0/es.bacchant.mahjong.zapsmahjongscor
10240 10265 I python  : set wchar paths...
 of crash
10240 10265 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 10265 (SDLThread), pid 10240 (psmahjongscorer)
10270 10270 W crash_dump32: type=1400 audit(0.0:43620): avc: denied { search } for uid=10242 name="/" dev="tmpfs" ino=15416 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:tmpfs:s0 tclass=dir permissive=0
10270 10270 I chatty  : uid=10242(es.bacchant.mahjong.zapsmahjongscorer) crash_dump32 identical 8 lines
10270 10270 W crash_dump32: type=1400 audit(0.0:43629): avc: denied { search } for uid=10242 name="/" dev="tmpfs" ino=15416 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:tmpfs:s0 tclass=dir permissive=0
10270 10270 W crash_dump32: type=1400 audit(0.0:43630): avc: denied { search } for uid=10242 name="app" dev="dm-2" ino=4522 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
10270 10270 W crash_dump32: type=1400 audit(0.0:43631): avc: denied { search } for uid=10242 name="app" dev="dm-2" ino=4522 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
10270 10270 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
 2202  2202 I /system/bin/tombstoned: received crash request for pid 10240
10270 10270 I crash_dump32: performing dump of process 10240 (target tid = 10265)
10270 10270 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10270 10270 F DEBUG   : Build fingerprint: 'motorola/cedric/cedric:8.1.0/OPPS28.85-13-2/d04a4:user/release-keys'
10270 10270 F DEBUG   : Revision: 'p500'
10270 10270 F DEBUG   : ABI: 'arm'
10270 10270 F DEBUG   : pid: 10240, tid: 10265, name: SDLThread  >>> es.bacchant.mahjong.zapsmahjongscorer <<<
10270 10270 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10270 10270 F DEBUG   :     r0 00000000  r1 00002819  r2 00000006  r3 00000008
10270 10270 F DEBUG   :     r4 00002800  r5 00002819  r6 97c55a74  r7 0000010c
10270 10270 F DEBUG   :     r8 00000000  r9 00000000  sl 00000000  fp 97c55ab8
10270 10270 F DEBUG   :     ip 00000000  sp 97c55a60  lr b464290d  pc b463c3fa  cpsr 200e0030
10270 10270 W crash_dump32: type=1400 audit(0.0:43632): avc: denied { search } for uid=10242 name="/" dev="tmpfs" ino=15416 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:tmpfs:s0 tclass=dir permissive=0
10270 10270 F DEBUG   : 
10270 10270 F DEBUG   : backtrace:
10270 10270 F DEBUG   :     #00 pc 0001a3fa  /system/lib/libc.so (abort+63)
10270 10270 F DEBUG   :     #01 pc 0016f88c  /mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/app/es.bacchant.mahjong.zapsmahjongscorer-tjLqIM63scHBfuTisLfQ4g==/lib/arm/libpython3.7m.so
@ghost
Copy link

ghost commented Jan 2, 2019

Note to anyone who wants to take a guess:

       LOGP("set wchar paths...");
  } else {
      // We do not expect to see crystax_python any more, so no point
      // reminding the user about it. If it does exist, we'll have
      // logged it earlier.
      LOGP("_python_bundle does not exist");
  }

  Py_Initialize();

#if PY_MAJOR_VERSION < 3
  PySys_SetArgv(argc, argv);
#endif

  LOGP("Initialized python");

This is the relevant start.c code section. So it is crashing either in Py_Initialize or PySys_SetArgv with an abort() call I would assume.

@ApplySci did you get a chance to test this on any other device? Are you using p4a master or the latest version on pypi?

@ApplySci
Copy link
Author

ApplySci commented Jan 4, 2019

p4a master, no other android devices available to test on

@ghost
Copy link

ghost commented Jan 5, 2019

So I'm not sure if this is really that, but what you're doing I wouldn't actually expect to work because I'm pretty sure openssl doesn't currently work with the python3 recipe, which is addressed by #1537 (still unmerged)

That may or may not be what you are seeing, but I wouldn't actually have expected what you're doing to work with p4a master as it is right now.

The only way to get OpenSSL to work right now is to either build from the #1537 pull request (pip install from https://github.com/opacam/python-for-android/archive/python-core-update.zip), or use python3crystax with the CrystaX NDK ( https://python-for-android.readthedocs.io/en/latest/buildoptions/#crystax-python3 ) and a specific fork by installing from https://github.com/JonasT/python-for-android/archive/master.zip.

This should be fixed in less than a month, we're kind of having a new year's eve hole right now 😬

@ApplySci
Copy link
Author

ApplySci commented Jan 5, 2019

Ok, thanks. Is SQLite in a similar state to openssl?

I tried python3crystax, but that crashed on Android 8.1, after working on 8.0. I'm after a route that will enable me to build an APK that will be accepted by the Play Store, so it's going to have to keep up with the API requirements. My impression is that this will need the Android NDk, not crystax

@ghost
Copy link

ghost commented Jan 5, 2019

Yes your best bet honestly might be waiting until we land #1537 on master. That might happen next week, but I obviously can't promise anything since it's a lot to review (just look at the amount of discussion comments) and I'm not one of the people giving the final approval 🤷‍♀️

@ghost
Copy link

ghost commented Jan 22, 2019

openssl should work now, but you need to put it before python3 in the requirements order (as well as sqlite3, so that they are enabled for the core modules in python3 itself):

requirements = sqlite3,open,python3,kivy,requests,urllib3,chardet,certifi,idna,android,pyjnius

Can you retry? Do you still have this issue?

@ghost ghost added the awaiting-reply label Jan 22, 2019
@ApplySci
Copy link
Author

I'm abandoning kivy. I've spent hundreds of hours fighting to get this working properly, and find myself constantly battling against counter-intuitive defaults and unnecessary complexity. I'm migrating to flutter.

@ghost
Copy link

ghost commented Jan 23, 2019

@ApplySci you're comparing a handful of volunteers to big Google corp with its resources, so yeah we are lacking a little behind 🤷‍♀️ hope you find what you're looking for in flutter! However just to note, without tickets especially about the defaults it often isn't that super trivial to notice from a devs point of view...

@tsrift
Copy link

tsrift commented Nov 15, 2019

Help!
I have similar problem with python 3.7
It crushes and I don't know why. According to this [https://github.com//issues/1562#issuecomment-450784408] it has to be in Py_Initialize(); becouse it doesn't log LOGP("Initialized python");

buildozer android logcat | grep python
11-16 13:20:23.776 29476 29476 V pythonutil: Loading library: python3.7m
11-16 13:20:23.780 29476 29476 V pythonutil: Loading library: main
11-16 13:20:23.783 29476 29476 V pythonutil: Failed to load _io.so or unicodedata.so...but that's okay.
11-16 13:20:23.783 29476 29476 V pythonutil: Unsatisfied linker when loading ctypes
11-16 13:20:23.783 29476 29476 V pythonutil: Loaded everything!
11-16 13:20:23.828 29476 29511 I python : Initializing Python for Android
11-16 13:20:23.829 29476 29511 I python : Setting additional env vars from p4a_env_vars.txt
11-16 13:20:23.829 29476 29511 I python : Changing directory to the one provided by ANDROID_ARGUMENT
11-16 13:20:23.829 29476 29511 I python : /data/user/999/org.test.cars/files/app
11-16 13:20:23.829 29476 29511 I python : Preparing to initialize python
11-16 13:20:23.829 29476 29511 I python : _python_bundle dir exists
11-16 13:20:23.829 29476 29511 I python : calculated paths to be...
11-16 13:20:23.829 29476 29511 I python : /data/user/999/org.test.cars/files/app/_python_bundle/stdlib.zip:/data/user/999/org.test.cars/files/app/_python_bundle/modules
11-16 13:20:23.829 29476 29511 I python : set wchar paths...

@83-p
Copy link

83-p commented Aug 17, 2020

The length (255+\0) of the path buffer is exceeded.
The length of /mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/user/0/es.bacchan t.mahjong.zapsmahjongscorer/files/app/_python_bundle/stdlib.zip:/mnt/expand/e6b17011-5846-4bcf-bf8e-d115767da9f0/user/0/es.bacchant.mahjong.zapsmahjongscorer/files/app/_python_bundle/modules is 256.

https://github.com/kivy/python-for-android/blob/develop/pythonforandroid/bootstraps/common/build/jni/application/src/start.c#L173

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

3 participants