Repository navigation
Commit 069dfde
committed
[BUGFIX] Bound the flush, and say nothing on the way to an outcome
Eight things from review, each measured rather than accepted on description.
The async handler logged five progress states that the synchronous one has
always logged and the async one never did. The session is registered before the
request is handed to the client, and none of those events retires it, so a log
handler calling ForceFlush() from one waited for the export whose call stack it
was standing in. Every other report in this file already retires before it logs,
which is what made the omission visible: the progress cases were the one place
that broke the file's own rule. They report nothing now, and the exhaustive
switch stays so a new state is still a compile error.
A flush with no deadline of its own waited without one. The bound this path had
before the accounting was fixed is response_timeout_, which is also the value
the request itself is given, so a session outstanding when the watermark is
taken has at most that long before the client owes it a terminal event. The
bound is unchanged; what changes is that running out of it no longer reports
success. That also keeps this independent of the curl client work, where a
transfer can be left with no callback at all.
The deadline was built after the mutex was taken, so time spent waiting for the
lock came out of nobody's budget and the caller was handed a fresh one. It is
taken at entry now, and ForceFlush has a single wait path rather than two.
The GiveUpGuard could not reach its active destructor: the shutdown return
disarmed it and retired by hand, the successful path disarmed it after
SendRequest, and there was no other return between them. It is gone, and the
handler takes the completion by move rather than by copy. The invariant it was
guarding is stated where the two exits are.
WaitForWatermarks had the same thirty second bound as the whole CTest case, so a
watermark that never arrived killed the process before the case reached its own
assertion. Five seconds for the helper, sixty for CTest. The CMake comment named
a case that never parks; it names the one that does.
Concurrency between ForceFlush and Shutdown is a MUST in the stable Logs SDK
specification and this exporter had no case for it. Two now: one where the
shutdown settles the outstanding session and the flush is woken by it rather
than by its own bound, and one where the shutdown settles nothing and the flush
ends anyway.
watermarks_taken is labelled as test synchronization rather than left looking
like exporter state.
Verified by putting each defect back: a progress line restored fails
EverySessionStateIsClassifiedAndReportsAtMostOnce, the bound removed fails
ANoDeadlineFlushGivesUpAtTheResponseTimeout, and the unbounded wait restored
hangs AParkedFlushEndsEvenIfTheShutdownSettlesNothing at exit 124. All 31 cases
pass in the async build, under AddressSanitizer and under ThreadSanitizer, with
no sanitizer report and the same count in each.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>1 parent 80b050f commit 069dfde
4 files changed
Lines changed: 195 additions & 72 deletions
File tree
- exporters/elasticsearch
- include/opentelemetry/exporters/elasticsearch
- src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
64 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
341 | 354 | | |
342 | 355 | | |
343 | 356 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | 357 | | |
348 | 358 | | |
349 | 359 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | 360 | | |
354 | 361 | | |
355 | 362 | | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | 366 | | |
370 | 367 | | |
371 | 368 | | |
| |||
482 | 479 | | |
483 | 480 | | |
484 | 481 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
489 | 485 | | |
490 | 486 | | |
491 | 487 | | |
| |||
500 | 496 | | |
501 | 497 | | |
502 | 498 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
525 | 503 | | |
526 | 504 | | |
527 | 505 | | |
528 | 506 | | |
529 | 507 | | |
530 | 508 | | |
531 | | - | |
532 | | - | |
533 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
534 | 512 | | |
535 | 513 | | |
536 | 514 | | |
| |||
573 | 551 | | |
574 | 552 | | |
575 | 553 | | |
576 | | - | |
577 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
578 | 558 | | |
579 | | - | |
580 | 559 | | |
581 | 560 | | |
582 | 561 | | |
| |||
627 | 606 | | |
628 | 607 | | |
629 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
630 | 628 | | |
631 | 629 | | |
632 | 630 | | |
| |||
639 | 637 | | |
640 | 638 | | |
641 | 639 | | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | 640 | | |
650 | 641 | | |
651 | 642 | | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | 643 | | |
657 | 644 | | |
658 | 645 | | |
| |||
0 commit comments