Indy_get_current_error fails when using maven dependency


#1

I am building an app using Indy for android, a first I downloaded the java wrapper directly from the github repository and added it into my Android Studio project. So far my app just creates a pool config and opens the connection to a ledger, it works fine. However, I decided to switch and add the java wrapper as a maven dependency for my project instead of directly having the java wrapper code in my project files.

My app tries to create a poolconfig and if it fails, it checks if the exception is a PoolLedgerConfigExistsException, if it is, then it just tries to open the connection. It works fine when the Java wrapper is in my files but when it is a maven dependency it only works if the configuration does not exists, otherwise, the app crashes when trying to create the indy exception and gives me this output:

at org.hyperledger.indy.sdk.LibIndy$API.indy_get_current_error(LibIndy.java:-2)
at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:74)
at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:67)
at org.hyperledger.indy.sdk.IndyException.<init>(IndyException.java:36)
at org.hyperledger.indy.sdk.IndyException.fromSdkError(IndyException.java:162)
at org.hyperledger.indy.sdk.IndyJava$API.checkResult(IndyJava.java:92)
at org.hyperledger.indy.sdk.LibIndy$API.indy_get_current_error(LibIndy.java:-2)
at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:74)
at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:67)
at org.hyperledger.indy.sdk.IndyException.<init>(IndyException.java:36)
at org.hyperledger.indy.sdk.IndyException.fromSdkError(IndyException.java:162)
at org.hyperledger.indy.sdk.IndyJava$API.checkResult(IndyJava.java:92)

I already debug the app and the error comes when creating the error details:

LibIndy.api.indy_get_current_error(errorDetailsJson);

I downloaded the library files from https://repo.sovrin.org/android/libindy/stable/1.8.2/
and added the maven repository, the dependency i am using is:

api 'org.hyperledger:indy:1.8.2'

I hope you could help me to find what I am doing wrong or to find a workaround to check If a pool configuration has been created (which I think could be a nice feature) already instead of waiting for the exception to be thrown.

Thank you so much


#2

I have the same problem. I added the files from the github repo to the project, but still can’t get the exceptions.

try {
        Pool.createPoolLedgerConfig("indy_pool_01", createPoolLedgerConfigJSONParameter.toJson()).get();
    } catch (ExecutionException e) {
        Log.w(TAG, "ExecutionException");
    } catch (InterruptedException e) {
        Log.w(TAG, " InterruptedException");
    } catch (PoolLedgerConfigExistsException e) {
        Log.w(TAG, "IndyException");
    } catch (IndyException e) {
        Log.w(TAG, "IndyException");
    } catch (Exception e) {
        Log.w(TAG, "Exception");
    }

produces the following output and the app crashes

2019-04-25 23:16:22.131 24412-24477/com.ssi.main A/zygote: runtime.cc:1726] Thread[12,tid=24477,Native,Thread*=0xe409b400,peer=0x133c0000,"Thread-29"] attempting to detach while still running code
2019-04-25 23:16:22.131 24412-24477/com.ssi.main A/zygote: runtime.cc:508] Runtime aborting...
2019-04-25 23:16:22.131 24412-24477/com.ssi.main A/zygote: runtime.cc:508] 
2019-04-25 23:16:22.132 24412-24477/com.ssi.main A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 24477 (Thread-29)

If the pool config doesnt exist when calling createPoolLedgerConfig, everything is fine.

Do you have an idea how to get the exceptions?


#3

I tried to call some other methods and provoked them to fail to see if i can get some indy exceptions. Unfortunately the app crashes everytime and no exceptions are thrown. Which libindy version do you use?


#4

I got the error the moment I updated to the wrapper version 1.8.x , using a previous version like the 1.7.0 allows to catch the exceptions as it does not call to the get_current_error method

For me, using a different version of the libraries (.so files) does not work, the error comes whenever I try to invoke that specific method. So I have to use a wrapper that does not use that method


#5

This is a very curious bug. I would look into making an issue on Hyperledger’s Jira instance here. A segmentation fault is a serious issue and the developers need to give this a closer look.

EDIT: actually, it looks like it’s a known issue already…


#6

Hi,

I have to same problem. I’m using 1.8.2 version and i can’t catch any exception. app always crashing.

F/zygote64( 8995): runtime.cc:1871] Thread[17,tid=9202,Native,Thread*=0x73f82d2000,peer=0x187c0000,"Thread-70"] attempting to detach while still running code
F/zygote64( 8995): runtime.cc:598] Runtime aborting...
F/zygote64( 8995): runtime.cc:598] Dumping all threads without appropriate locks held: thread list lock mutator lock
F/zygote64( 8995): runtime.cc:598] All threads:

........

F/zygote64( 8995): runtime.cc:598] Aborting thread:
F/zygote64( 8995): runtime.cc:598] "Thread-70" prio=5 tid=17 Native
F/zygote64( 8995): runtime.cc:598]   | group="" sCount=0 dsCount=0 flags=0 obj=0x187c0000 self=0x73f82d2000
F/zygote64( 8995): runtime.cc:598]   | sysTid=9202 nice=0 cgrp=default sched=0/0 handle=0x73f04fa4f0
F/zygote64( 8995): runtime.cc:598]   | state=R schedstat=( 219505623 13999689 140 ) utm=14 stm=7 core=5 HZ=100
F/zygote64( 8995): runtime.cc:598]   | stack=0x73f02fc000-0x73f02fe000 stackSize=2045KB
F/zygote64( 8995): runtime.cc:598]   | held mutexes= "abort lock"
F/zygote64( 8995): runtime.cc:598]   native: #00 pc 00000000003cc138  /system/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*)+208)
F/zygote64( 8995): runtime.cc:598]   native: #01 pc 00000000004a0450  /system/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, bool, BacktraceMap*, bool) const+348)
F/zygote64( 8995): runtime.cc:598]   native: #02 pc 0000000000487bb8  /system/lib64/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream<char, std::__1::char_traits<char>>&, art::Thread*) const+56)
F/zygote64( 8995): runtime.cc:598]   native: #03 pc 00000000004878f8  /system/lib64/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char>>&) const+536)
F/zygote64( 8995): runtime.cc:598]   native: #04 pc 0000000000475d3c  /system/lib64/libart.so (art::Runtime::Abort(char const*)+196)
F/zygote64( 8995): runtime.cc:598]   native: #05 pc 0000000000570348  /system/lib64/libart.so (android::base::LogMessage::~LogMessage()+996)
F/zygote64( 8995): runtime.cc:598]   native: #06 pc 00000000004758a0  /system/lib64/libart.so (art::Runtime::DetachCurrentThread()+472)
F/zygote64( 8995): runtime.cc:598]   native: #07 pc 00000000003039f4  /system/lib64/libart.so (art::JII::DetachCurrentThread(_JavaVM*)+52)
F/zygote64( 8995): runtime.cc:598]   native: #08 pc 000000000011b280  /system/lib64/libart.so (art::CheckJII::DetachCurrentThread(_JavaVM*)+100)
F/zygote64( 8995): runtime.cc:598]   native: #09 pc 000000000000b8a0  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (???)
F/zygote64( 8995): runtime.cc:598]   native: #10 pc 000000000000faec  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (???)
F/zygote64( 8995): runtime.cc:598]   native: #11 pc 000000000000fe3c  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (???)
F/zygote64( 8995): runtime.cc:598]   native: #12 pc 0000000000307c40  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libindy.so (_$LT$indy..utils..logger..LibindyLogger$u20$as$u20$log..Log$GT$::log::hb49d801afa725c68+532)
F/zygote64( 8995): runtime.cc:598]   native: #13 pc 0000000000e1f1f8  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libindy.so (log::__private_api_log::hddab05ecccb8400f+136)
F/zygote64( 8995): runtime.cc:598]   native: #14 pc 000000000050a36c  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libindy.so (indy_get_current_error+92)
F/zygote64( 8995): runtime.cc:598]   native: #15 pc 000000000000fdb0  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (ffi_call_SYSV+96)
F/zygote64( 8995): runtime.cc:598]   native: #16 pc 000000000000f5a0  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (ffi_call+292)
F/zygote64( 8995): runtime.cc:598]   native: #17 pc 0000000000005bc0  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (???)
F/zygote64( 8995): runtime.cc:598]   native: #18 pc 00000000000079dc  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/lib/arm64/libjnidispatch.so (Java_com_sun_jna_Native_invokeInt+32)
F/zygote64( 8995): runtime.cc:598]   native: #19 pc 0000000000004438  /data/app/com.sample.wallet-_VQQ9cXBoyHF3_juY8CcTw==/oat/arm64/base.odex (???)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.Native.invokeInt(Native method)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.Function.invoke(Function.java:419)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.Function.invoke(Function.java:354)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.Library$Handler.invoke(Library.java:244)
F/zygote64( 8995): runtime.cc:598]   at java.lang.reflect.Proxy.invoke(Proxy.java:913)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.LibIndy$API.indy_get_current_error(LibIndy.java:-2)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:74)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.IndyException$ErrorDetails.<init>(IndyException.java:67)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.IndyException.<init>(IndyException.java:36)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.wallet.InvalidWalletException.<init>(InvalidWalletException.java:18)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.IndyException.fromSdkError(IndyException.java:120)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.IndyJava$API.checkResult(IndyJava.java:92)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.wallet.Wallet.access$100(Wallet.java:19)
F/zygote64( 8995): runtime.cc:598]   at org.hyperledger.indy.sdk.wallet.Wallet$1.callback(Wallet.java:51)
F/zygote64( 8995): runtime.cc:598]   at java.lang.reflect.Method.invoke(Native method)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
F/zygote64( 8995): runtime.cc:598]   at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)

#7

Use version 1.7, it solves the problem