Skip to content

Commit 113de2b

Browse files
fix(grpc): drain log stream gracefully on success path in solve_lp/mip
stop_log_streaming() calls TryCancel() which races against the server's final log drain: poll_for_completion() returns as soon as the job is marked complete, then TryCancel() kills the stream before the server has finished sending remaining lines (e.g. "Best objective …"). Add drain_log_streaming(): polls log_stream_done_ (set when the thread exits naturally after receiving the job_complete sentinel) for up to 5s, then falls back to stop_log_streaming(). Use it on the success path in solve_lp and solve_mip so all final log lines are received before the stream is torn down. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
1 parent 02feec8 commit 113de2b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

cpp/src/grpc/client/grpc_client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ void grpc_client_t::drain_log_streaming()
319319
// common non-streaming solve path.
320320
if (!log_thread_) return;
321321

322+
322323
// On the success path the server drains all pending log lines and then sends
323324
// a job_complete sentinel; the streaming thread exits naturally when that
324325
// sentinel arrives. Poll for natural completion (up to kDrainTimeout) so

0 commit comments

Comments
 (0)