mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 992 forks source link

Restarting download "txhashset-NNNNN.zip" every 10 min on Sync step 2 - never finish #3706

Open Novator opened 2 years ago

Novator commented 2 years ago

The step 1 passed good. Then "Current Status: Sync step 2/7: Downloading 1041(MB) chain state for state sync: 58% at 263.0(kB/s)", and when pass 10 minutes, in tab "Logs" there are appeared messages:

20220427 01:51:18.614 WARN grin_servers::grin::server - Grin server started.
20220427 01:51:18.617 WARN grin_servers::mining::stratumserver - Stratum server started on 127.0.0.1:3416                                                                                         
20220427 02:01:19.885 ERROR grin_servers::grin::sync::state_sync - state_sync: TxHashsetDownload status timeout in 10 minutes!
20220427 02:01:19.896 ERROR grin_servers::grin::sync::state_sync - state_sync: error = Sync error
  Cause: Unknown
  Backtrace: . restart fast sync
20220427 02:11:19.903 ERROR grin_servers::grin::sync::state_sync - state_sync: TxHashsetDownload status timeout in 10 minutes!
20220427 02:11:19.914 ERROR grin_servers::grin::sync::state_sync - state_sync: error = Sync error
  Cause: Unknown
  Backtrace: . restart fast sync

New file "/home/user/.grin/main/tmp/txhashset-NNNNN.zip" starts to download. Meanwhile previous file "../txhashset-NNNNN.zip" also is continuing download. After 10 minute the situation repeats. So, the third "../txhashset-NNNNN.zip" starts, and so on. Now I have already 5 (FIVE, CARL!!!) files are downloading, and no one is finished.

So, you need to take into consideration, it exists not fast connections (I have 5 Mbits/sec): 1) increase 10 minute limit to 30 minute or some alike 2) break downloading the first file 3) continue to download previous interrupted zip-file.

Give me an advice please, how can I pass step 2 in present version (grin-v5.2.0-alpha.1-linux-amd64.tar.gz)?

Novator commented 2 years ago

I downloaded sources and install Rust with this manual: https://github.com/mimblewimble/grin/blob/master/doc/build.md then I found the file: /grin/servers/src/grin/sync/state_sync.rs line 219: if now - prev > Duration::minutes(10) {

I've changed it to: if now - prev > Duration::minutes(60) { then rebuild and restart grin.

Now step 2 has gone ok.

Guys, I think you should apply this in "master" branch, maybe even to add setup parameter for this.

Good luck!

mmgen commented 1 year ago

Thank you very much for this workaround. It fixed the problem for me. On a slow connection, the download can take longer than 60 minutes, so some will have to increase the value. I set it to 240 just to be on the safe side.

PIBD aims to solve this issue by requesting the UTXO set in pieces. Unfortunately, implementation is going very slowly, considering the RFC was published 2 years ago.