Commit 7881111
committed
fix(pubsub): return cancelled messages to the publisher's waiter
When a batch for an ordering key fails, the failure callback also cancels
the messages still accumulating in that key's un-flushed MessagesBatch and
drops the batch, but decrements messagesWaiter only by the in-flight batch's
size. Those cancelled messages each incremented the waiter when they were
published and never become part of any OutstandingBatch, so nothing ever
decrements for them and pendingCount can no longer reach zero.
Publisher.shutdown() waits on that counter uninterruptibly and without a
timeout, so it never returns. awaitTermination(timeout, unit) is documented
to be called after shutdown(), so its bound is never reached either.
Return the cancelled count to the waiter alongside the batch's own.
Fixes #140011 parent 9337a93 commit 7881111
2 files changed
Lines changed: 60 additions & 1 deletion
File tree
- java-pubsub/google-cloud-pubsub/src
- main/java/com/google/cloud/pubsub/v1
- test/java/com/google/cloud/pubsub/v1
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
549 | 553 | | |
550 | 554 | | |
551 | 555 | | |
| |||
556 | 560 | | |
557 | 561 | | |
558 | 562 | | |
| 563 | + | |
559 | 564 | | |
560 | 565 | | |
561 | 566 | | |
| |||
564 | 569 | | |
565 | 570 | | |
566 | 571 | | |
567 | | - | |
| 572 | + | |
| 573 | + | |
568 | 574 | | |
569 | 575 | | |
570 | 576 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
646 | 699 | | |
647 | 700 | | |
648 | 701 | | |
| |||
0 commit comments