Fatal signal 11 (SIGSEGV), code 1 when calling model.load()

When starting the application I get the following output and app crashes:

 W/linker: libpytorch_jni.so: unused DT entry: type 0x6ffffffe arg 0x2f524
    libpytorch_jni.so: unused DT entry: type 0x6fffffff arg 0x3
    libfbjni.so: unused DT entry: type 0x6ffffffe arg 0x2e18c
W/linker: libfbjni.so: unused DT entry: type 0x6fffffff arg 0x2
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 19006 (rg.pytorch.demo)
Process 19006 terminated.
My `build.gradle`:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

repositories {
    jcenter()
    maven {
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}

android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    compileSdkVersion 28
    defaultConfig {
        applicationId "org.pytorch.demo"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    def camerax_version = '1.0.0-alpha05'
    implementation "androidx.camera:camera-core:$camerax_version"
    implementation "androidx.camera:camera-camera2:$camerax_version"
    implementation 'com.google.android.material:material:1.0.0-beta01'


    implementation 'org.pytorch:pytorch_android:1.4.0-SNAPSHOT'
    implementation 'org.pytorch:pytorch_android_torchvision:1.4.0-SNAPSHOT'
    implementation 'com.google.firebase:firebase-ml-vision:24.0.1'
}

What causes the crash?

The strangest thing that I already launched the app early.
And as I have the previous built .apk I compared it with my new one.
And they differ in sizes of libs (on the screen below), but when I replace my new libs in …/gradle/caches/… by older ones and build app in Android Studio they are replaced again.

So why app is built with different libs in different cases?

Is that possible that pytorch_android_torchvision:1.4.0-SNAPSHOT was updated and older version worked while current doesn’t…?

This is a bug. Fix is https://github.com/pytorch/pytorch/pull/31582 . Should be available in the next nightly build. Sorry for the trouble.

You mean I have to make correspond corrects like in https://github.com/pytorch/pytorch/pull/31582/commits/25345223c6c6e5912f2d02894bf4475270ad1a12 ?

or vice versa??

Oh, no. Sorry. I meant it is a bug in PyTorch, and that commit should fix it. Please try again with the latest nightly release, without changing any of your code, and the problem should be gone.

1 Like

thanks, problem has gone)