You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(TODO): record b9739 Windows JNI common_params_parse(GetCommandLineW) regression
Root-cause write-up only (fix deferred per discussion). On Windows x86_64,
b9739's common_params_parse has a _WIN32 prologue that replaces the
caller-supplied argv with GetCommandLineW() (the host process command line).
Correct for the standalone llama-server.exe, but under JNI the process is
java.exe (no --model on its command line), so the parse fails with
"Failed to parse model parameters" for every model-loading Java test. Affects
both the MSVC and Ninja DLLs; Linux/macOS unaffected. Documents symptom,
exact upstream code (arg.cpp:924-931), why our argv is platform-neutral, and
three fix options to choose from later.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SfvSZ76NW4e1qX1PjL4RKq
It unconditionally replaces the caller's argv with the host **process** command line
169
+
(`GetCommandLineW()`). For the standalone `llama-server.exe` this is correct (fixes UTF-8 CLI args).
170
+
For an **embedded/JNI** caller the process is **`java.exe`**, whose command line has no `--model`, so
171
+
`common_params_parse_ex` fails and `common_params_parse` returns `false` → our "Failed to parse model
172
+
parameters". `common_params_parse_ex` is `static`, so we cannot bypass the block by calling the inner
173
+
parser. Our JNI already passes correct UTF-8 argv (`GetStringUTFChars`), so the re-derivation is
174
+
unnecessary for us. **This is an upstream bug affecting every embedded Windows consumer of
175
+
`common_params_parse`.**
176
+
177
+
**Fix options (decide later):**
178
+
1. FetchContent `PATCH_COMMAND` that **guards** the block — only override when `make_utf8_argv()` arg
179
+
count equals the caller's `argc` (true for the standalone exe, false for JNI). Minimal + semantically
180
+
correct; also the shape to PR upstream.
181
+
2. FetchContent patch that **removes** the `_WIN32` override for our build.
182
+
3. File an upstream issue/PR and wait for a fixed llama.cpp build.
183
+
184
+
Any patch re-applies on every llama.cpp bump — add it to the upgrade checklist. Pre-existing on `main`
185
+
since #247 (b9682→b9739); independent of the Windows-Ninja classifier work. Windows **build + C++ ctest**
186
+
jobs are green; only the Windows **Java/inference** jobs are affected.
187
+
138
188
### llama.cpp upstream feature exposure (queued, deferred by policy)
139
189
140
190
These are JNI plumbing items for upstream API additions. Policy: add only after a real user request — they are mostly relevant to specific model families or specialized workflows.
0 commit comments