Skip to content

Fix segfault on musl when downloading models via --hf-repo#21290

Closed
WhyNotHugo wants to merge 1 commit intoggml-org:masterfrom
WhyNotHugo:fix-segfault
Closed

Fix segfault on musl when downloading models via --hf-repo#21290
WhyNotHugo wants to merge 1 commit intoggml-org:masterfrom
WhyNotHugo:fix-segfault

Conversation

@WhyNotHugo
Copy link
Copy Markdown
Contributor

On musl-based, the default thread stack size is only ~130KB. libstdc++'s std::regex implementation uses deep recursion for backtracking, which exceeds this and cause segfaults parsing redirect URLs with complex regex patterns.

Create a download threads with a 1MB stack size, which is sufficient for the regex backtracking depth required by typical HuggingFace redirect URLs.

Fixes: #21280

Requirements

On musl-based, the default thread stack size is only ~130KB. libstdc++'s
std::regex implementation uses deep recursion for backtracking, which
exceeds this and cause segfaults parsing redirect URLs with complex
regex patterns.

Create a download threads with a 1MB stack size, which is sufficient for
the regex backtracking depth required by typical HuggingFace redirect
URLs.

Fixes: ggml-org#21280
@angt
Copy link
Copy Markdown
Member

angt commented Apr 2, 2026

Way too intrusive IMO, and not really an issue of llama.cpp. Please try this: #21280 (comment)

@WhyNotHugo WhyNotHugo closed this Apr 2, 2026
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

Successfully merging this pull request may close these issues.

Misc. bug: segfault downloading models

2 participants