Commit a9cf378
Francois ROBION
Allow heartbeat to restart the pipe thread with only sync commands
There is a thread looping in the method
PhysicalConnection.ReadFromPipe to process response from Redis, match
them with the sent command and signaling the completion of the
message. If this thread has an exception, its catch block will call
RecordConnectionFailed which will proceed to restart a new thread to
continue reading Redis responses.
However, if another exception occurred in the catch before the new
thread can be started (in a case of high memory pressure, OOM
exceptions can happen anywhere) we are in a state where no one is
reading the pipe of Redis responses, and all commands sent end in
timeout.
If at least one async command is sent, the heartbeat thread will
detect the timeout in the OnBridgeHeartbeat method, and if no read
were perform for 4 heartbeat it will issue a connection failure.
With this commit, this becomes true for sync commands as well.
Therefore, it ensures we will not reach a state were all commands end
in timeout.1 parent 862a70e commit a9cf378
File tree
2 files changed
+16
-8
lines changed- src/StackExchange.Redis
2 files changed
+16
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
| 618 | + | |
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
| 668 | + | |
668 | 669 | | |
669 | 670 | | |
670 | 671 | | |
671 | 672 | | |
672 | 673 | | |
673 | 674 | | |
674 | | - | |
| 675 | + | |
675 | 676 | | |
676 | 677 | | |
677 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | | - | |
750 | | - | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
751 | 752 | | |
752 | | - | |
| 753 | + | |
| 754 | + | |
753 | 755 | | |
754 | 756 | | |
755 | 757 | | |
| |||
776 | 778 | | |
777 | 779 | | |
778 | 780 | | |
779 | | - | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
780 | 788 | | |
781 | 789 | | |
782 | 790 | | |
| |||
791 | 799 | | |
792 | 800 | | |
793 | 801 | | |
794 | | - | |
795 | 802 | | |
796 | 803 | | |
797 | 804 | | |
| |||
0 commit comments