Skip to content

fix: rpc-server cache may not work in Windows environments - #22394

Merged
ggerganov merged 2 commits into
ggml-org:masterfrom
unraido:fix-rpc-server-cache
Apr 27, 2026
Merged

ggerganov merged 2 commits into
ggml-org:masterfrom
unraido:fix-rpc-server-cache

Conversation

@unraido

@unraido unraido commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Overview

Even when cache is enabled on the rpc-server in a Windows environment, the rpc directory is not automatically created, and therefore, cache files within that directory are not created.
Furthermore, only the first character of the cache file name is output to the log, making it difficult to notice that cache files are not being generated.

Additional information

Before
Before fix

After
After fix

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, This PR description translated with AI assistance.

@unraido
unraido requested a review from a team as a code owner April 26, 2026 14:07
@github-actions github-actions Bot added examples ggml changes relating to the ggml tensor library for machine learning labels Apr 26, 2026
@inforithmics

Copy link
Copy Markdown

I could reproduce the bug, but didn't try the fix.

@rgerganov rgerganov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, just one comment inline

Comment thread ggml/src/ggml-rpc/ggml-rpc.cpp Outdated
fs::path cache_file = fs::path(cache_dir) / hash_str;
std::ofstream ofs(cache_file, std::ios::binary);
ofs.write((const char *)data, size);
#ifdef _WIN32

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need for ifdef, this seems to work on both linux and win32:

GGML_LOG_INFO("[%s] saved to '%s'\n", __func__, cache_file.string().c_str());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you. Based on the specifications of the C++ standard library, I initially thought that cache_file.string().c_str() would work in all environments.

However, when submitting the pull request, I changed it to conditional compilation using #ifdef for the following reasons:

  • Similar issues were not found in operating systems other than Windows.
  • This code is executed in almost all environments where rpc-server is launched, regardless of the processor, OS, or character encoding. This would require extensive testing, but I don't have access to that many different environments.
  • If #ifdef were not used, I thought it would be necessary to submit a pull request including test code or test cases, but I decided that this would make things too complicated.

The reason why the modification of the directory path separator for creating the cache file is not enclosed in an #ifdef statement, despite these reasons, is because the original code already modified the definition of DIRECTORY_SEPARATOR using #ifdef _WIN32.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the conditional compilation using #ifdef.

@ggerganov
ggerganov merged commit ceaf47c into ggml-org:master Apr 27, 2026
42 of 46 checks passed
IntelNav pushed a commit to IntelNav/llama.cpp that referenced this pull request Apr 29, 2026
…22394)

* fix: create directory and log cache file name.

* Remove GGML_LOG_INFO conditional compilation.

---------

Co-authored-by: kotaro <[email protected]>
baramofme pushed a commit to baramofme/llama-cpp-turboquant that referenced this pull request May 23, 2026
…22394)

* fix: create directory and log cache file name.

* Remove GGML_LOG_INFO conditional compilation.

---------

Co-authored-by: kotaro <[email protected]>
MrLordCat referenced this pull request in MrLordCat/llama.cpp-rdna-lab Jul 16, 2026
* fix: create directory and log cache file name.

* Remove GGML_LOG_INFO conditional compilation.

---------

Co-authored-by: kotaro <[email protected]>
zommiommy pushed a commit to zommiommy/llama.cpp that referenced this pull request Aug 18, 2026
…22394)

* fix: create directory and log cache file name.

* Remove GGML_LOG_INFO conditional compilation.

---------

Co-authored-by: kotaro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants