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 when running in debug #33

Open
veloce opened this issue Jul 17, 2023 · 7 comments
Open

[Android] Crash when running in debug #33

veloce opened this issue Jul 17, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@veloce
Copy link
Collaborator

veloce commented Jul 17, 2023

Since I installed the 1.4.0 version on lichess mobile, I get a crash on android each time I start to analyse a position, when running in debug. (I believe there is no problem in release mode, but I haven't checked for sure).

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
Cause: null pointer dereference
    x0  0000000000000000  x1  b4000077ff0597d0  x2  0000000000000000  x3  000000772b0a7953
    x4  00000076747446b8  x5  000000772f06d9c0  x6  0000992d000097ec  x7  000097320000995d
    x8  0000000000000000  x9  6e8111fab3b8fca3  x10 6e8111fab3b8fca3  x11 0000000000000010
    x12 0000000000000869  x13 0000967b000095f4  x14 00000000000ab04e  x15 000000273c83f51a
    x16 000000770d4639a0  x17 00000079e42f4c00  x18 0000007672502000  x19 00000000000005c7
    x20 b40000775f0d3bd0  x21 b40000774f0e83b0  x22 0000000000000000  x23 0000000000008f70
    x24 000000000000063c  x25 000000770d4583e0  x26 00000000000005fa  x27 00000079bf6716e8
    x28 0000000000008000  x29 0000007674744750
    lr  000000770d458a70  sp  0000007674744750  pc  000000770d458a70  pst 0000000060001000
backtrace:
      #00 pc 000000000000ca70  /system/lib64/libsoundpool.so (std::__1::__shared_ptr_pointer<_jobject*, (anonymous namespace)::make_shared_weakglobalref_from_localref(_JNIEnv*, _jobject*)::'lambda'(_jobject*), std::__1::allocator<_jobject> >::__on_zero_shared()+24) (BuildId: 7edb0bed6472f7cc98cd807f4686c293)
      #01 pc 000000000000c458  /system/lib64/libsoundpool.so ((anonymous namespace)::ConcurrentHashMap<android::SoundPool*, std::__1::shared_ptr<_jobject> >::~ConcurrentHashMap()+120) (BuildId: 7edb0bed6472f7cc98cd807f4686c293)
      #02 pc 00000000000b9ca4  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+280) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b)
      #03 pc 00000000000ac944  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b)
      #04 pc 0000000000086e84  /data/app/~~cdpj1pH9f8RYf1rmHy9Y_Q==/org.lichess.mobileV2-N-GRiA8RV6gRWSXBX0l2Sg==/lib/arm64/libstockfish.so (Stockfish::Eval::NNUE::verify()+1880) (BuildId: cd76b5ca9d2b576e80aae8ea9e78d2a9f8deaa2f)
      #05 pc 000000000009ec10  /data/app/~~cdpj1pH9f8RYf1rmHy9Y_Q==/org.lichess.mobileV2-N-GRiA8RV6gRWSXBX0l2Sg==/lib/arm64/libstockfish.so (Stockfish::MainThread::search()+452) (BuildId: cd76b5ca9d2b576e80aae8ea9e78d2a9f8deaa2f)
      #06 pc 00000000000b4e44  /data/app/~~cdpj1pH9f8RYf1rmHy9Y_Q==/org.lichess.mobileV2-N-GRiA8RV6gRWSXBX0l2Sg==/lib/arm64/libstockfish.so (Stockfish::Thread::idle_loop()+276) (BuildId: cd76b5ca9d2b576e80aae8ea9e78d2a9f8deaa2f)
      #07 pc 00000000000b9a20  /data/app/~~cdpj1pH9f8RYf1rmHy9Y_Q==/org.lichess.mobileV2-N-GRiA8RV6gRWSXBX0l2Sg==/lib/arm64/libstockfish.so (void* Stockfish::start_routine<Stockfish::Thread, std::__ndk1::pair<Stockfish::Thread*, void (Stockfish::Thread::*)()> >(void*)+40) (BuildId: cd76b5ca9d2b576e80aae8ea9e78d2a9f8deaa2f)
      #08 pc 00000000000b63b0  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b)
      #09 pc 00000000000530b8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 01331f74b0bb2cb958bdc15282b8ec7b)
Lost connection to device.

The crash is due to stockfish not able to load the NNUE file.

Since the previous working version was 274cf52e637e9a663d226ec31cc0b24e639cb615, I believe this commit is the cause of the issue: lichess-org@3fab174, probably because of the namespace.

I'm not really sure what is needed to keep the compatibility of AGP and avoid that bug.
Also it is probably worth investigating why it crashes in that case instead of exiting properly.

@veloce veloce added the bug Something isn't working label Jul 17, 2023
@daohoangson
Copy link
Collaborator

Crashed only in debug mode?

@veloce
Copy link
Collaborator Author

veloce commented Jul 17, 2023

No sure actually, will confirm you asap.
I made a release build that worked but it was probably because stockfish was already compiled.

@veloce
Copy link
Collaborator Author

veloce commented Jul 18, 2023

It does not crash in release mode @daohoangson

@daohoangson
Copy link
Collaborator

Is this resolved yet?

@veloce
Copy link
Collaborator Author

veloce commented Oct 8, 2023

Haven't tried recently because I use a fork to avoid the issue. But I'll try again with the main package, keep you posted.

@daohoangson
Copy link
Collaborator

What did you do in the fork that made it work? Only reverting the namespace commit or something else?

@veloce
Copy link
Collaborator Author

veloce commented Oct 8, 2023

Only reverting the namespace commit iirc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants