Commit 2f5d953
fix(resp3): accept push frames; count nil _ as miss in arbitrary command tracking (#435)
* fix(resp3): accept push frames; count nil _ as miss in arbitrary command tracking
Two RESP3 correctness bugs surfaced by the 2.4 readiness review.
#27: aggregate_type() lacked '>'. A server-pushed message (pubsub,
keyspace notifications, client tracking invalidation) on a RESP3
connection hit the "unsupported response" path and dropped the
connection. Now accepts and drains push frames inline.
#25: SingleNullBulk and ArrayPerElementNulls miss sentinels only
recognised RESP2 nil shapes ($-1/*-1/*0). RESP3 nil (_\r\n) was
miscounted as a hit, silently understating miss rate and
suppressing --miss-rate-threshold warnings.
Refs: 2.4 review findings #25 + #27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(resp3): flag RESP3 null at construction; distinguish from literal "_"
Bugbot flagged that the ArrayPerElementNulls walker used a content
heuristic (value_len==1 && value[0]=='_') that couldn't tell a
RESP3 null parsed via single_type from a real bulk value of literal
"_" parsed via blob_type. Both produce identical bulk_el.
Added bulk_el::is_resp3_null flag, set only when single_type
constructs the element for type byte '_'. Walker now reads the flag
directly instead of inferring from content. Test added that stores
"_" values and asserts they are NOT counted as misses.
Refs: bugbot LOW on PR #435
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(resp3): drain server-pushed frames without delivering as reply
Reviewer caught that the prior commit accepted RESP3 push (>) into
aggregate_type() but didn't suppress its effect on m_last_response.
The push frame fully parsed AS a reply, response_ended() returned 1,
and memtier dequeued the push as the reply to the next in-flight
command -- corrupting latency attribution + hit/miss accounting.
Adds an m_push drain-mode flag:
- Set when a push aggregate is encountered at top level
- Suppresses every mutation to m_last_response while true
- Cleared in response_ended(), which returns false so the parser
continues to read the actual reply
- Reset on rs_initial transition
Refs: 2.4 review of PR #435 (R1 CRITICAL).
* fix(resp3): reset m_response_len when draining push frame
Bugbot caught that response_ended()'s m_push drain returned false
without resetting m_response_len. The accumulated push frame bytes
stayed in the counter and contaminated set_total_len() for the
actual reply, skewing bandwidth and per-op size statistics.
Resetting m_response_len to 0 at the push-drain-complete site
matches the behaviour at rs_initial (the only other site where
m_response_len is reset).
Refs: bugbot LOW on PR #435 (follow-up).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(resp3): clear both m_push and m_attribute together in response_ended()
Bugbot caught that if an attribute (|) appears nested inside a push
frame (>), and both complete at the same response_ended() call,
the m_attribute branch fired first and returned false, leaving
m_push set. The parser then consumed the actual command reply as
push-drain data, desynchronizing the connection.
response_ended() now clears whichever flags are set in a single
call and returns false if either was set.
Refs: bugbot LOW on PR #435 (follow-up).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 6288b5f commit 2f5d953
4 files changed
Lines changed: 280 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
799 | | - | |
800 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
801 | 803 | | |
802 | | - | |
| 804 | + | |
803 | 805 | | |
804 | 806 | | |
805 | 807 | | |
| |||
853 | 855 | | |
854 | 856 | | |
855 | 857 | | |
856 | | - | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
857 | 867 | | |
858 | 868 | | |
859 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
| |||
181 | 190 | | |
182 | 191 | | |
183 | 192 | | |
184 | | - | |
| 193 | + | |
| 194 | + | |
185 | 195 | | |
186 | 196 | | |
187 | 197 | | |
| |||
471 | 481 | | |
472 | 482 | | |
473 | 483 | | |
474 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
475 | 494 | | |
476 | 495 | | |
477 | 496 | | |
| |||
498 | 517 | | |
499 | 518 | | |
500 | 519 | | |
501 | | - | |
502 | | - | |
503 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
504 | 533 | | |
505 | 534 | | |
| 535 | + | |
506 | 536 | | |
507 | 537 | | |
508 | 538 | | |
| |||
519 | 549 | | |
520 | 550 | | |
521 | 551 | | |
| 552 | + | |
522 | 553 | | |
523 | 554 | | |
524 | 555 | | |
| |||
553 | 584 | | |
554 | 585 | | |
555 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
556 | 594 | | |
557 | 595 | | |
558 | 596 | | |
559 | 597 | | |
560 | 598 | | |
561 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
562 | 603 | | |
563 | 604 | | |
564 | 605 | | |
| |||
574 | 615 | | |
575 | 616 | | |
576 | 617 | | |
577 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
578 | 623 | | |
579 | 624 | | |
580 | 625 | | |
| |||
589 | 634 | | |
590 | 635 | | |
591 | 636 | | |
592 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
593 | 640 | | |
594 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
595 | 645 | | |
596 | 646 | | |
597 | 647 | | |
| |||
609 | 659 | | |
610 | 660 | | |
611 | 661 | | |
612 | | - | |
| 662 | + | |
613 | 663 | | |
614 | 664 | | |
615 | 665 | | |
616 | 666 | | |
617 | 667 | | |
618 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
619 | 674 | | |
620 | 675 | | |
621 | 676 | | |
622 | 677 | | |
623 | 678 | | |
624 | 679 | | |
625 | | - | |
| 680 | + | |
| 681 | + | |
626 | 682 | | |
627 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
628 | 687 | | |
629 | 688 | | |
630 | 689 | | |
| |||
650 | 709 | | |
651 | 710 | | |
652 | 711 | | |
653 | | - | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
654 | 715 | | |
655 | 716 | | |
656 | 717 | | |
| |||
660 | 721 | | |
661 | 722 | | |
662 | 723 | | |
663 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
664 | 732 | | |
665 | 733 | | |
666 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
0 commit comments