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

Segmentation fault (core dumped) when generating #1292

Closed
4 tasks done
anhcq3003 opened this issue Mar 20, 2024 · 4 comments
Closed
4 tasks done

Segmentation fault (core dumped) when generating #1292

anhcq3003 opened this issue Mar 20, 2024 · 4 comments

Comments

@anhcq3003
Copy link

anhcq3003 commented Mar 20, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

Please provide a detailed written description of what you were trying to do, and what you expected llama-cpp-python to do.
I am coding project chatbot using model mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf, i use Flask to code BE and React to code FE.
The model will stream words as usual.
Screenshot from 2024-03-20 15-03-33

Current Behavior

Please provide a detailed written description of what llama-cpp-python did, instead.
While i chat with bot, sometime the error will generate and server is down:

Llama.generate: prefix-match hit
Segmentation fault (core dumped)

Screenshot from 2024-03-20 15-05-01

Environment and Context

Please provide detailed information about your computer setup. This is important in case the issue is not reproducible except for under certain specific conditions.

  • Physical (or virtual) hardware you are using, e.g. for Linux:

$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
CPU family: 6
Model: 79
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 1
CPU max MHz: 3000.0000
CPU min MHz: 1200.0000
BogoMIPS: 4600.03
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdts
cp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid a
perfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse
4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave av
x f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault
invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invp
cid rtm rdseed adx xsaveopt
Virtualization features:
Hypervisor vendor: Xen
Virtualization type: full
Caches (sum of all):
L1d: 512 KiB (16 instances)
L1i: 512 KiB (16 instances)
L2: 4 MiB (16 instances)
L3: 45 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-31
Vulnerabilities:
Gather data sampling: Not affected
Itlb multihit: KVM: Mitigation: VMX unsupported
L1tf: Mitigation; PTE Inversion
Mds: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Hos
t state unknown
Meltdown: Mitigation; PTI
Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Hos
t state unknown
Retbleed: Not affected
Spec rstack overflow: Not affected
Spec store bypass: Vulnerable
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer saniti
zation
Spectre v2: Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIB
RS Not affected
Srbds: Not affected
Tsx async abort: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Hos
t state unknown

  • Operating System, e.g. for Linux:

$ uname -a
Linux ip-172-31-2-143 6.5.0-1015-aws #15~22.04.1-Ubuntu SMP Tue Feb 20 20:12:08 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

  • SDK version, e.g. for Linux:
$ python3 --version
python 3.10.12
$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
I use llm-cpp-python to create chatbot, my server is p3.8xlarge with 245GB RAM and 4 GPU T4 16GB VRAM. But i just use llm-cpp-python with only CPU to load model (because when i try use both CPU and GPU, it give 1 bug that i can't handle).
I use model mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf to infer. When i chat, the model generate normally, but after a few turn chat, the server is crash because error segmentation fault.

Steps to Reproduce

Please provide detailed steps for reproducing the issue. We are not sitting in front of your screen, so the more detail the better.

  1. Install llm-cpp-python with pip install llm-cpp-python (just use CPU)
  2. run Flask server
  3. Chat on UI, the server will take segmentation fault core dumped after a few turn chat.
  4. etc.

Failure Logs

Example environment info:

222.252.45.59 - - [20/Mar/2024 07:53:33] "OPTIONS /sse_pool_default/ HTTP/1.1" 200 -
Give me information about New York City
Llama.generate: prefix-match hit
222.252.45.59 - - [20/Mar/2024 07:53:34] "POST /sse_pool_default/ HTTP/1.1" 200 -

llama_print_timings:        load time =    1439.73 ms
llama_print_timings:      sample time =     306.22 ms /   512 runs   (    0.60 ms per token,  1671.98 tokens per second)
llama_print_timings: prompt eval time =       0.00 ms /     1 tokens (    0.00 ms per token,      inf tokens per second)
llama_print_timings:        eval time =   83089.99 ms /   512 runs   (  162.29 ms per token,     6.16 tokens per second)
llama_print_timings:       total time =   85267.06 ms /   513 tokens
222.252.45.59 - - [20/Mar/2024 07:58:31] "OPTIONS /sse_pool_default/ HTTP/1.1" 200 -
Give me information about New York City
Llama.generate: prefix-match hit
222.252.45.59 - - [20/Mar/2024 07:58:32] "POST /sse_pool_default/ HTTP/1.1" 200 -
222.252.45.59 - - [20/Mar/2024 07:58:46] "OPTIONS /sse_pool_default/ HTTP/1.1" 200 -
Give me information about New York City
Llama.generate: prefix-match hit
Segmentation fault (core dumped)
@davorceman
Copy link

google directed me to this issue.
I was searching for "segfault aws ubuntu" with filter for only last 24h

My issue is maybe not relevant to your
I'm maintaining some CI jobs, and one started failing with this error.

What I notied is that this started recently and only difference is new kernel version which maching yours 6.5.0-1015-aws.
With 6.5.0-1014-aws everything is fine on my side.

It would be great if you can try to boot your instance with 1014 just to confirm if it works there.

@anhcq3003
Copy link
Author

google directed me to this issue. I was searching for "segfault aws ubuntu" with filter for only last 24h

My issue is maybe not relevant to your I'm maintaining some CI jobs, and one started failing with this error.

What I notied is that this started recently and only difference is new kernel version which maching yours 6.5.0-1015-aws. With 6.5.0-1014-aws everything is fine on my side.

It would be great if you can try to boot your instance with 1014 just to confirm if it works there.

Thank you very much. I will try doing it your way.

@anhcq3003
Copy link
Author

Update:
I think my problem lies in the Front-end. When I'm chatting and FE makes a call to the BE API, there are times when I'm streaming the answer, suddenly it hangs there and calls the BE API again and streams from the beginning.
Therefore, I added "openWhenHidden: true", so the FE side does not call the API multiple times for the same answer. For each chat, only one answer is called.
I fixed it and it works fine, I don't get the segmentation failed error anymore.

@abetlen
Copy link
Owner

abetlen commented Apr 3, 2024

Might be same issue as #1319 should be fixed in v0.2.59. I'll re-open if it's not.

@abetlen abetlen closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants