fix: delay in TimeOffset applied to AdjustedTime caused by send/recei… #28007

pull techy2 wants to merge 1 commits into bitcoin:master from techupgrades:timeoffset changing 2 files +67 −3
  1. techy2 commented at 8:02 PM on June 29, 2023: none

    On busy VPS and shared host with limited resources, the time between when a messages is sent to the tcpip send or receive queue and when it is sent in the case of send queue, or when it is processed (ProcessMessage) can be in excess of 30 seconds. This delay introduces a skew in AdjustedTime.

    For the receive queue, the post processing uses the receive time prior to entering the queue to calculate TimeOffset rather than Now() which currently includes the delay in the queue.

    For the send queue, the queued message is altered to update the nTime of the message to the actual time it is being sent rather than the time at which it was queued

    Was tested on an hp 370 G6 24 core 3ghz 192gb host with the daemon launched with -par=2 to restrict the resources of the daemon. Logging was added pre-patch to document the delay through the queue and was observed for both send and receive to be occasionally > 30 seconds when the daemon was busy following the tip or during reorgs when the cup utilization for the assigned core approached 100%. Significant queue delay occurs most often in the receive queue (several times a minute) and infrequently in the send queue ( 1 observation in several hours of testing ).

    Checklist:

    Go over all the following points, and put an x in all the boxes that apply.

    • [X ] I have performed a self-review of my own code
    • [X ] I have commented my code, particularly in hard-to-understand areas
    • I have added or updated relevant unit/integration/functional/e2e tests
    • I have made corresponding changes to the documentation
    • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)
  2. fix: delay in TimeOffset applied to AdjustedTime caused by send/receive message queues 0cf727382d
  3. DrahtBot commented at 8:02 PM on June 29, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #27509 (Relay own transactions only via short-lived Tor or I2P connections by vasild)
    • #27407 (net, refactor: Privatise CNode send queue by dergoegge)
    • #26621 (refactor: Continue moving application data from CNode to Peer by dergoegge)
    • #25390 (sync: introduce a thread-safe generic container and use it to remove a bunch of "GlobalMutex"es by vasild)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. maflcko commented at 8:16 PM on June 29, 2023: member

    Duplicate of #6642?

  5. maflcko commented at 8:17 PM on June 29, 2023: member

    See also #25908

  6. DrahtBot added the label CI failed on Jun 29, 2023
  7. techy2 commented at 11:53 PM on June 29, 2023: none

    Pointer offset error not flagged in my build. Will close this pull and open a new one with issue resolved. Testing solution now.

  8. techy2 closed this on Jun 29, 2023

  9. bitcoin locked this on Jun 28, 2024
Labels

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: 2026-04-28 00:13 UTC

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