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

Malformed grammar crashes the server #3878

Closed
dkogut1996 opened this issue Oct 31, 2023 · 0 comments · Fixed by #6004
Closed

Malformed grammar crashes the server #3878

dkogut1996 opened this issue Oct 31, 2023 · 0 comments · Fixed by #6004

Comments

@dkogut1996
Copy link

Sending malformed grammar crashes the server example.

For instance, sending

curl --location 'localhost:8080/completion' \
--header 'Content-Type: application/json' \
--data '{
    "grammar": "Root ::= [^\n]+ \"\n#\""
}'

to the server (built using make server and run via ./server -m <model>) will crash the server with the following exception:
libc++abi: terminating due to uncaught exception of type std::out_of_range: map::at: key not found. The r in root was capitalized, which is the source of the bad grammar.

Tested on an M1 Max Mac using commit 238657d.

This was referenced Nov 21, 2023
HanClinto added a commit to HanClinto/llama.cpp that referenced this issue Mar 11, 2024
…turning valid grammar structure. This is an alternate fix location to put the required root node in sampling.cpp instead of grammar-parser.cpp.
HanClinto added a commit to HanClinto/llama.cpp that referenced this issue Mar 11, 2024
HanClinto added a commit to HanClinto/llama.cpp that referenced this issue Mar 12, 2024
…turning valid grammar structure. This is an alternate fix location to put the required root node in sampling.cpp instead of grammar-parser.cpp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant