GUI freezes during IBD when time is set to the next day #18953

issue MarcoFalke openend this issue on May 11, 2020
  1. MarcoFalke commented at 9:54 pm on May 11, 2020: member

    Steps to reproduce:

    • Set time to next day
    • Start IBD
    • Wait
    • GUI freezes

    See also #16417 and #2001

  2. MarcoFalke added the label Bug on May 11, 2020
  3. MarcoFalke added the label GUI on May 11, 2020
  4. MarcoFalke commented at 9:59 pm on May 11, 2020: member
    Screenshot_2020-05-10 GUI freezes during IBD when time is set to the next day · Issue #18953 · bitcoin bitcoin
  5. MarcoFalke commented at 10:00 pm on May 11, 2020: member
    Same happens when the time is set back by one day. Maybe an RPC request is needed for the freeze here as well, haven’t checked that.
  6. rebroad commented at 1:43 pm on March 25, 2021: contributor
    I find the GUI freezes during IBD in general, and was going to raise an issue for this - perhaps the title of this issue could be changed to remove the “when…”?
  7. hebasto commented at 3:52 pm on March 25, 2021: member

    Cannot reproduce this issue on master (9217f9fe7351d9c36803456f88ae561e23f17ac9):

    DeepinScreenshot_select-area_20210326174704

  8. ghost commented at 4:46 pm on March 25, 2021: none

    I had tried experimenting with this. It’s difficult to reproduce this because it’s intermittent. Sometimes GUI will freeze on a machine, will work fine next time you try or on other machine. So I assumed it’s not an issue with Bitcoin Core itself.

    I had tried on Windows as host, Windows in VM, Ubuntu as host and Ubuntu in VM. Bitcoin Core v0.21.0

  9. hebasto commented at 5:23 pm on March 25, 2021: member

    @prayank23

    … it’s intermittent.

    If you were lucky to reproduce it, maybe you got a backtrace from a debugger?

  10. ghost commented at 5:27 pm on March 25, 2021: none

    I didn’t try today. It was something that happened with me because VM was using date from host and my CMOS battery was dead so host machine was using some crazy date from 2093.

    Will share logs if I can reproduce it on my desktop.

  11. hebasto commented at 8:46 pm on March 25, 2021: member

    The BitcoinGUI::subscribeToCoreSignals, that is called from the BitcoinGUI ctor, uses the this pointer.

    Would it be, that https://github.com/bitcoin/bitcoin/blob/9217f9fe7351d9c36803456f88ae561e23f17ac9/src/timedata.cpp#L95 is called before BitcoinGUI object is fully initialized?

  12. RandyMcMillan commented at 0:16 am on March 21, 2022: contributor

    This seems to fix it…

    The change of the nTimeOffset data type from int to int64_t in

    https://github.com/RandyMcMillan/bitcoin/commit/65f78a111ff52c2212cc0a423662e7a41d1206dd#diff-86e079f53ae0a450c42ec1d282a458154002b99d5802b9c1f7396e209c67bdfaR176

    seems to be the root of the issue…

    Patch/FIx:

     0diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
     1index d6706fd009..877de36faf 100644
     2--- a/src/qt/guiutil.cpp
     3+++ b/src/qt/guiutil.cpp
     4@@ -750,7 +750,7 @@ QString formatPingTime(std::chrono::microseconds ping_time)
     5 
     6 QString formatTimeOffset(int64_t nTimeOffset)
     7 {
     8-  return QObject::tr("%1 s").arg(QString::number((int)nTimeOffset, 10));
     9+  return QObject::tr("%1 s").arg(QString::number(nTimeOffset, 10));
    10 }
    11 
    12 QString formatNiceTimeOffset(qint64 secs)
    

    https://github.com/bitcoin/bitcoin/compare/master...RandyMcMillan:1647799609-1647799494-master-18953

    The argument used to be an int

    QString formatDurationStr(int secs);

    NOTE:

    https://github.com/RandyMcMillan/bitcoin/commit/65f78a111ff52c2212cc0a423662e7a41d1206dd#diff-86e079f53ae0a450c42ec1d282a458154002b99d5802b9c1f7396e209c67bdfaR176


    A note on debugging/testing:

    This issue may be illusive because it takes 5 peers connected - to be expressed.

    https://github.com/bitcoin/bitcoin/blob/ae005a647ffa1d457c5c7a0528cb29f3b1937b96/src/timedata.cpp#L76

    Spoofing the node time is useful:

    As mentioned above +/- one day triggers a similar condition.

    One difference that I have noticed is that when the time is spoofed negative - all nodes that connect prior to the bug - don’t begin syncing with the node - besides the initial handshake.

     0diff --git a/src/util/time.cpp b/src/util/time.cpp
     1index f7712f0dc8..6872a6871e 100644
     2--- a/src/util/time.cpp
     3+++ b/src/util/time.cpp
     4@@ -30,7 +30,7 @@ int64_t GetTime()
     5 
     6     time_t now = time(nullptr);
     7     assert(now > 0);
     8-    return now;
     9+    return now - 24*60*60;
    10 }
    11 
    12 bool ChronoSanityCheck()
    

    On the contrary - when the time is spoofed in the positive - the first node will begin to sync (send block data).

     0diff --git a/src/util/time.cpp b/src/util/time.cpp
     1index f7712f0dc8..6872a6871e 100644
     2--- a/src/util/time.cpp
     3+++ b/src/util/time.cpp
     4@@ -30,7 +30,7 @@ int64_t GetTime()
     5 
     6     time_t now = time(nullptr);
     7     assert(now > 0);
     8-    return now;
     9+    return now + 24*60*60;
    10 }
    11 
    12 bool ChronoSanityCheck()
    

    Tweaking the -maxtimeadjustment setting seems to have an effect that I haven’t fully looked into… more testing with the patches above may offer some more insight…

    0$ make appbundle && ./Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt -signet -maxtimeadjustment 10000000
    
  13. MarcoFalke commented at 3:06 pm on March 29, 2022: member
    This should be reopened when there is a stacktrace
  14. MarcoFalke closed this on Mar 29, 2022

  15. DrahtBot locked this on Mar 29, 2023

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: 2024-11-23 21:12 UTC

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