maid icon indicating copy to clipboard operation
maid copied to clipboard

[Bug]: App crashes after sending message in chat.

Open Theblackcat98 opened this issue 9 months ago • 9 comments

Describe the bug After downloading a model through the settings menu, and choosing it from the drop-down; then heading to the chat and sending the first message the app crashes and closes by itself.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Settings'
  2. Click on 'Load a model'
  3. Pick one
  4. Send a message
  5. Crash

Expected behavior Some sort of error checking and or log to determine why the app crashed.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Device: [Pixel 7]
  • Platform: [Android]
  • App Version: [2.0.5]

Additional context Suggestion: add a visual way to know if the model is properly loaded in memory.

Theblackcat98 avatar Apr 08 '25 15:04 Theblackcat98

I can confirm this happening on me too, using version 2.0.5 on github release, but weirdly enough, if i ran the smallest model possible (so small it generates just randon garbage, also i forgot what the name was as i modified the file name, but it contained word llama and size 2 MB) with short prompt like "hi" it didnt crash, but with something just little bit heavier like SmolLM 135M (Instruct, Q8) (and bit of waiting just to make sure the model is loaded to memory) as soon as i send prompt it crashes within a second. This didnt happen with Termux llama-cpp (CPU mode)

Here's crash prompt of me sending "hi" with SmolLM:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
crDroid Version: 'unknown'
Build fingerprint: 'Redmi/topaz_global/topaz:14/UKQ1.230917.001/V816.0.7.0.UMGMIXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2025-04-10 18:46:36.960471751+0700
Process uptime: 550s
Cmdline: com.danemadsen.maid
pid: 9716, tid: 18157, name: DartWorker  >>> com.danemadsen.maid <<<
uid: 10569
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0x00000073c9f7ec48
    x0  0000000000000001  x1  00000077b83e9ec4  x2  00000077b83e9ec4  x3  000000750cadf558
    x4  0000000000000018  x5  0000000000000001  x6  0000000000000030  x7  000000750cadf382
    x8  b4000076e7878d48  x9  ffffffffffffffff  x10 00000077b83ea024  x11 0000000000018002
    x12 0000000000000002  x13 0000000000000000  x14 0000000000000001  x15 0000000000000000
    x16 00000000ffffffff  x17 0000000000000000  x18 000000750bc50000  x19 b4000076e7878d40
    x20 b400007627881058  x21 00000073c9ffbb70  x22 b4000076e7877e40  x23 b4000076a7bc2ad1
    x24 0000000000000001  x25 000000000000000a  x26 b4000076a7bc2ad0  x27 b400007627881058
    x28 00000073c9ffbb68  x29 000000750cadf840
    lr  00000073c9f7e680  sp  000000750cadf590  pc  00000073c9f7ec48  pst 0000000060000000
29 total frames
backtrace:
      #00 pc 000000000017ec48  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (unicode_regex_split(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>>> const&)+12648)
      #01 pc 000000000016e768  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llm_tokenizer_bpe_session::tokenize(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, std::__ndk1::vector<int, std::__ndk1::allocator<int>>&)+76)
      #02 pc 000000000016c88c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llama_vocab::impl::tokenize(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, bool, bool) const+604)
      #03 pc 0000000000169328  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llama_vocab::impl::load(llama_model_loader&, LLM_KV const&)+3548)
      #04 pc 0000000000118c00  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llama_model::load_vocab(llama_model_loader&)+72)
      #05 pc 00000000000c99ec  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000)
      #06 pc 00000000000c9480  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llama_model_load_from_file+180)
      #07 pc 0000000000196e0c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libllama.so (offset 0x137f000) (llama_llm_init+384)
      #08 pc 00000000002d15dc  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #09 pc 00000000006dadfc  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #10 pc 00000000006dad10  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #11 pc 00000000006dacac  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #12 pc 00000000006daaf4  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #13 pc 00000000006da9a4  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #14 pc 00000000006da924  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #15 pc 00000000006da8d8  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #16 pc 0000000000722fc4  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #17 pc 00000000002e40a4  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #18 pc 0000000000722fc4  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #19 pc 00000000002e3278  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #20 pc 00000000002d3d3c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk (offset 0x84000) (BuildId: cde83d064ebc93e68f5eb4dee7b1da88)
      #21 pc 00000000008a736c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #22 pc 00000000008b2e3c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #23 pc 00000000008b7cb8  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #24 pc 00000000008b7b08  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #25 pc 000000000092fa2c  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #26 pc 0000000000911b44  /data/app/~~np3Y-o4hjfLXsE_3CwkKcg==/com.danemadsen.maid-t7gYn4F5I6j89SeD1kOhPQ==/base.apk!libflutter.so (offset 0x7b7000) (BuildId: 2aeae4ff9b8d8a1788e9fb37b76302097f4f35dd)
      #27 pc 000000000006af88  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+132) (BuildId: 74597bf719b16863bd29bcdb336ad689)
      #28 pc 000000000005e1e8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 74597bf719b16863bd29bcdb336ad689)

ABJ4403 avatar Apr 10 '25 11:04 ABJ4403

I have 8GB memory and like 6GB free memory, and running llama-cpp with Termux only eats 2GB max, so idk why it crashes on maid (also yes the model i use is custom picked, not downloaded in maid, but if in termux llama-cpp works, why not maid?)

Also if possible i suggest adding toggle to enable/disable GPU acceleration (that doesnt really fix the main issue, but ita useful for ppl that desperately wants local AI)

Also weirdly i can load invalid file as model (i created empty file with gguf extension, selected it as model, and uhh... maid just fine with it, ofc i sent message and it crashed)

ABJ4403 avatar Apr 11 '25 02:04 ABJ4403

Okayy this is weird, so yes as you've said, built-in model doesnt crash, but i decided to do lil' experiment, so the models are placed in /data/data/$PKG/cache/model.gguf (in this case, model is tinyllama-1.1b-chat-v1.0.Q2_K) (why cache? if user pressed clear cache they have to download the model again...), so with powahh of root, i replaced the model.gguf (in this case i replaced it with Llama 3.2 1B Q2, keeping the same name) force stop and reopen maid, send message, didnt crash this time, so basically only files picked from file picker will crash, maybe perhaps its not found?

Tho i noticed the RAM usage baloons up really high, i cant even use Llama 3.2 3B Q3KS, but i can use it on Termux without RAM usage balooning up as much, so maybe there also memory leak there?

ABJ4403 avatar Apr 14 '25 05:04 ABJ4403

Also running into this on a Pixel 7 running the latest F-Droid build (I uninstalled after running into this but on looking it up it looks to be 2.0.4)

chaosharmonic avatar Apr 30 '25 00:04 chaosharmonic

Its been a month, when will this issue be fixed?

ABJ4403 avatar May 25 '25 17:05 ABJ4403