Git commit
9c7f9a2
Operating System & Version
Ubuntu 24.04
GGML backends
CUDA
Command-line arguments used
docker run --name sdcpp -it --rm --gpus all --entrypoint '' -v /mnt/models:/models -p 1234:1234 ghcr.io/leejet/stable-diffusion.cpp:master-cuda /sd-server -m /models/model.safetensors -l 0.0.0.0
Steps to reproduce
- Start container
- Open browser at http://localhost:1234/
- Enter prompt
- Click "Generate Image" button
- server_error
What you expected to happen
Generation succeeds
What actually happened
Generation failed
Logs / error messages / stack trace
HTTP request body to /sdcpp/v1/img_gen
{"prompt":"asdf","negative_prompt":"","clip_skip":-1,"width":512,"height":512,"strength":0.75,"seed":-1,"sample_params":{"sample_steps":20,"shifted_timestep":0,"custom_sigmas":[],"guidance":{"txt_cfg":7,"distilled_guidance":3.5,"slg":{"layers":[7,8,9],"layer_start":0.01,"layer_end":0.2,"scale":0}}},"lora":[],"vae_tiling_params":{"enabled":false,"tile_size_x":0,"tile_size_y":0,"target_overlap":0.5,"rel_size_x":0,"rel_size_y":0},"cache_mode":"disabled","cache_option":"","scm_mask":"","scm_policy_dynamic":true,"output_format":"png","output_compression":100,"batch_count":1,"auto_resize_ref_image":true,"increase_ref_index":false,"control_strength":0.9,"init_image":null,"ref_images":[],"mask_image":null,"control_image":null}
HTTP response
{"error":"server_error","message":"filesystem error: status: Operation not permitted [./proc/1/map_files/200400000-200600000]"}
Additional context / environment details
This seems to fix the issue
diff --git a/examples/server/runtime.cpp b/examples/server/runtime.cpp
index 1127ab7..7c13ad6 100644
--- a/examples/server/runtime.cpp
+++ b/examples/server/runtime.cpp
@@ -254,23 +254,31 @@ void refresh_lora_cache(ServerRuntime& rt) {
fs::path lora_dir = rt.ctx_params->lora_model_dir;
if (fs::exists(lora_dir) && fs::is_directory(lora_dir)) {
- for (auto& entry : fs::recursive_directory_iterator(lora_dir, fs::directory_options::skip_permission_denied)) {
- if (!entry.is_regular_file()) {
- continue;
+ try {
+ for (auto& entry : fs::recursive_directory_iterator(lora_dir, fs::directory_options::skip_permission_denied)) {
+ if (!entry.is_regular_file()) {
+ continue;
+ }
+ const fs::path& p = entry.path();
+ if (!is_supported_model_ext(p)) {
+ continue;
+ }
+
+ LoraEntry lora_entry;
+ lora_entry.name = p.stem().u8string();
+ lora_entry.fullpath = p.u8string();
+ std::string rel = p.lexically_relative(lora_dir).u8string();
+ std::replace(rel.begin(), rel.end(), '\\', '/');
+ lora_entry.path = rel;
+
+ new_cache.push_back(std::move(lora_entry));
}
- const fs::path& p = entry.path();
- if (!is_supported_model_ext(p)) {
- continue;
- }
-
- LoraEntry lora_entry;
- lora_entry.name = p.stem().u8string();
- lora_entry.fullpath = p.u8string();
- std::string rel = p.lexically_relative(lora_dir).u8string();
- std::replace(rel.begin(), rel.end(), '\\', '/');
- lora_entry.path = rel;
-
- new_cache.push_back(std::move(lora_entry));
+ } catch (const std::filesystem::filesystem_error& e) {
+ log_print(SD_LOG_DEBUG,
+ std::string("filesystem error in lora cache refresh: ")
+ .append(e.what())
+ .c_str(),
+ true, false);
}
}
@@ -296,22 +304,30 @@ void refresh_upscaler_cache(ServerRuntime& rt) {
fs::path upscaler_dir = rt.ctx_params->hires_upscalers_dir;
if (fs::exists(upscaler_dir) && fs::is_directory(upscaler_dir)) {
- for (auto& entry : fs::directory_iterator(upscaler_dir)) {
- if (!entry.is_regular_file()) {
- continue;
+ try {
+ for (auto& entry : fs::directory_iterator(upscaler_dir)) {
+ if (!entry.is_regular_file()) {
+ continue;
+ }
+ const fs::path& p = entry.path();
+ if (!is_supported_model_ext(p)) {
+ continue;
+ }
+
+ UpscalerEntry upscaler_entry;
+ upscaler_entry.name = p.stem().u8string();
+ upscaler_entry.fullpath = fs::absolute(p).lexically_normal().u8string();
+ upscaler_entry.model_name = "ESRGAN_4x";
+ upscaler_entry.path = p.filename().u8string();
+
+ new_cache.push_back(std::move(upscaler_entry));
}
- const fs::path& p = entry.path();
- if (!is_supported_model_ext(p)) {
- continue;
- }
-
- UpscalerEntry upscaler_entry;
- upscaler_entry.name = p.stem().u8string();
- upscaler_entry.fullpath = fs::absolute(p).lexically_normal().u8string();
- upscaler_entry.model_name = "ESRGAN_4x";
- upscaler_entry.path = p.filename().u8string();
-
- new_cache.push_back(std::move(upscaler_entry));
+ } catch (const std::filesystem::filesystem_error& e) {
+ log_print(SD_LOG_DEBUG,
+ std::string("filesystem error in upscaler cache refresh: ")
+ .append(e.what())
+ .c_str(),
+ true, false);
}
}
Git commit
9c7f9a2
Operating System & Version
Ubuntu 24.04
GGML backends
CUDA
Command-line arguments used
docker run --name sdcpp -it --rm --gpus all --entrypoint '' -v /mnt/models:/models -p 1234:1234 ghcr.io/leejet/stable-diffusion.cpp:master-cuda /sd-server -m /models/model.safetensors -l 0.0.0.0
Steps to reproduce
What you expected to happen
Generation succeeds
What actually happened
Generation failed
Logs / error messages / stack trace
HTTP request body to
/sdcpp/v1/img_gen{"prompt":"asdf","negative_prompt":"","clip_skip":-1,"width":512,"height":512,"strength":0.75,"seed":-1,"sample_params":{"sample_steps":20,"shifted_timestep":0,"custom_sigmas":[],"guidance":{"txt_cfg":7,"distilled_guidance":3.5,"slg":{"layers":[7,8,9],"layer_start":0.01,"layer_end":0.2,"scale":0}}},"lora":[],"vae_tiling_params":{"enabled":false,"tile_size_x":0,"tile_size_y":0,"target_overlap":0.5,"rel_size_x":0,"rel_size_y":0},"cache_mode":"disabled","cache_option":"","scm_mask":"","scm_policy_dynamic":true,"output_format":"png","output_compression":100,"batch_count":1,"auto_resize_ref_image":true,"increase_ref_index":false,"control_strength":0.9,"init_image":null,"ref_images":[],"mask_image":null,"control_image":null}HTTP response
{"error":"server_error","message":"filesystem error: status: Operation not permitted [./proc/1/map_files/200400000-200600000]"}Additional context / environment details
This seems to fix the issue