Commit fe7348a
authored
fix(grpc): drain all remaining log lines at job completion in StreamLogs (#1508)
## Summary
- `StreamLogs` did a single extra `getline` after detecting job completion, silently dropping any lines flushed between the last EOF poll and the job-complete marker
- With multiple final log lines (e.g. `"Optimal solution found."` followed by `"Best objective ..."`), only the first was streamed to the client
- Replace the single read with a drain loop so all buffered lines are sent before the `job_complete` sentinel
## Root cause
`test_cli_lp_remote` and `test_cli_mip_remote` both parse the CLI subprocess output for solver status and objective. In remote mode the CLI streams server logs via gRPC. The race: if the solver logs two final lines in quick succession and the job is marked complete before `StreamLogs` polls again, the old code sent exactly one of those lines and dropped the rest.
The probability scales with I/O load (more xdist workers = more contention = wider race window), which is why it surfaced when experimenting with higher `-n` values in pytest-xdist.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Authors:
- Ramakrishna Prabhu (https://github.com/ramakrishnap-nv)
Approvers:
- Alice Boucher (https://github.com/aliceb-nv)
URL: #15081 parent 081462f commit fe7348a
3 files changed
Lines changed: 60 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
| |||
308 | 310 | | |
309 | 311 | | |
310 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
311 | 335 | | |
312 | 336 | | |
313 | 337 | | |
| |||
848 | 872 | | |
849 | 873 | | |
850 | 874 | | |
851 | | - | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
852 | 882 | | |
853 | 883 | | |
854 | 884 | | |
| |||
875 | 905 | | |
876 | 906 | | |
877 | 907 | | |
878 | | - | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
879 | 913 | | |
880 | 914 | | |
881 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| |||
419 | 423 | | |
420 | 424 | | |
421 | 425 | | |
| 426 | + | |
422 | 427 | | |
423 | 428 | | |
424 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
833 | 835 | | |
834 | 836 | | |
835 | 837 | | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
842 | 841 | | |
843 | 842 | | |
844 | | - | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
845 | 848 | | |
846 | 849 | | |
847 | 850 | | |
848 | | - | |
849 | | - | |
850 | | - | |
| 851 | + | |
| 852 | + | |
851 | 853 | | |
852 | 854 | | |
853 | 855 | | |
| |||
0 commit comments