Accept unordered tracepoints in interface_usdt_utxocache.py #32101

pull willcl-ark wants to merge 1 commits into bitcoin:master from willcl-ark:usdt-order-independent changing 1 files +22 −11
  1. willcl-ark commented at 12:48 pm on March 20, 2025: member

    We have encountered an instance where the tracepoints were not collected in the same order they were fired (#31951).

    Tracepoint ordering is not guaranteed in userspace for a number of reasons.

    As this test does not require a strict collection/processing order collect expected and actual events into dicts and compare them.

    This will gracefully handle both the number of events, and out-of-order events should they reoccur in the future.

    Fixes: #31951

  2. DrahtBot commented at 12:48 pm on March 20, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32101.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK laanwj, 0xB10C

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. fanquake requested review from 0xB10C on Mar 21, 2025
  4. 0xB10C commented at 3:54 pm on March 24, 2025: contributor

    ACK 693d1e2f54baa0d5e407153f79b2f98385e6b8d9

    I successfully ran the changed test a couple of times and the code changes look good to me.

    That this behavior works as intended can be tested with this patch:

     0diff --git a/test/functional/interface_usdt_utxocache.py b/test/functional/interface_usdt_utxocache.py
     1index d4213d5020..94ec23c51a 100755
     2--- a/test/functional/interface_usdt_utxocache.py
     3+++ b/test/functional/interface_usdt_utxocache.py
     4@@ -326,6 +326,7 @@ class UTXOCacheTracepointTest(BitcoinTestFramework):
     5                 event.is_coinbase
     6             )
     7
     8+        expected_utxocache_adds.reverse()
     9         expected_add_keys = {(e["txid"], e["index"], e["height"], e["value"], e["is_coinbase"])
    10                              for e in expected_utxocache_adds}
    11         expected_spent_keys = {(e["txid"], e["index"], e["height"], e["value"], e["is_coinbase"])
    
  5. laanwj added the label Tests on Mar 26, 2025
  6. in test/functional/interface_usdt_utxocache.py:319 in 693d1e2f54 outdated
    315@@ -324,9 +316,26 @@ def handle_utxocache_spent(_, data, __):
    316 
    317         self.log.info(
    318             f"check that we successfully traced {EXPECTED_HANDLE_ADD_SUCCESS} adds and {EXPECTED_HANDLE_SPENT_SUCCESS} spent")
    319-        for expected_utxo, actual_event in zip(expected_utxocache_adds + expected_utxocache_spents,
    320-                                               actual_utxocache_adds + actual_utxocache_spents):
    321-            compare_utxo_with_event(expected_utxo, actual_event)
    322+
    


    laanwj commented at 1:42 pm on March 26, 2025:
    Maybe add a comment about the events possible arriving out of order (to make it clear why this is done without the context of this PR).

    willcl-ark commented at 2:15 pm on March 26, 2025:

    Good idea. Added a comment in 248fdd88dcf651a0560a3eedfb8af61f38c61400

    git range-diff 693d1e2f54baa0d5e407153f79b2f98385e6b8d9...248fdd88dcf651a0560a3eedfb8af61f38c61400


    laanwj commented at 2:37 pm on March 26, 2025:
    Thanks!
  7. willcl-ark force-pushed on Mar 26, 2025
  8. test: accept unordered tracepoints in...
    ...interface_usdt_utxocache.py
    
    We have encountered an instance where the tracepoints were not collected
    in the same order they were fired (#31951).
    
    Tracepoint ordering is not guaranteed in userspace for a number of
    reasons.
    
    As this test does not require a strict collection/processing order
    collect `expected` and `actual` events into dicts and compare them.
    
    This will gracefully handle both the number of events, and out-of-order
    events should they reoccur in the future.
    248fdd88dc
  9. willcl-ark force-pushed on Mar 26, 2025
  10. laanwj approved
  11. laanwj commented at 2:38 pm on March 26, 2025: member
    Code review ACK 248fdd88dcf651a0560a3eedfb8af61f38c61400
  12. 0xB10C commented at 5:23 pm on March 26, 2025: contributor
    re-ACK 248fdd88dcf651a0560a3eedfb8af61f38c61400
  13. fanquake merged this on Mar 27, 2025
  14. fanquake closed this on Mar 27, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-03-28 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me