Skip to content

server: don't forget to fflush #6251

Closed
@bviksoe

Description

@bviksoe

Since the "logs unified format" (#5700) restructuring of the server example some time ago, only one of the code-paths in the server_log() function calls fflush after emitting stdout output. Only the code-path that generates text log-style uses fflush, while the JSON formatting does not.

This causes a problem on some platforms (Windows for me) when hosting server as a child process. Log output never reaches the stdio consuming host. Also, using fflush tends to solve a race between stderr and stdout output on some platforms.

https://github.com/ggerganov/llama.cpp/blob/50ccaf5eacb50a2ca378a4ef0dc7aeb45fead652/examples/server/utils.hpp#L80

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions