Bitcoin Forum
November 17, 2024, 11:36:58 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core starts syncing from scratch if not stopped properly  (Read 527 times)
kaicrypzen (OP)
Hero Member
*****
Offline Offline

Activity: 1344
Merit: 656



View Profile
December 16, 2016, 03:57:24 PM
 #1

Hi,

My computer restarted while Bitcoin Core was syncing, then when I executed Bitcoin Core it started syncing from scratch. This has happened twice, and I was wondering if this was normal and if there was something to do to tell it to start from where it stopped. The blk files are still in blocks folder so I don't understand why (it thinks) it needs to resync.

I also had a case when the blockchain was corrupted (due to false postive virus detection), in this case when I relaunched Bitcoin Core, some index was rebuilt and syncing went fast to the point when the corruption occurred and then started syncing at a normal speed. This is not what it does when launched after my computer restarts while it was running (i.e. Bitcoin Core not properly closed).

I am running Bitcoin Core 0.13.1 64-bit on a 64-bit Windows 10.

Thank you.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
December 16, 2016, 04:03:16 PM
 #2

First of all, it is NOT resynching. It is reindexing the databases. The databases are separate from the blk files and when it is corrupted, it needs to be entirely rebuilt.

kaicrypzen (OP)
Hero Member
*****
Offline Offline

Activity: 1344
Merit: 656



View Profile
December 16, 2016, 04:15:15 PM
 #3

First of all, it is NOT resynching. It is reindexing the databases. The databases are separate from the blk files and when it is corrupted, it needs to be entirely rebuilt.

In the case of a corrupted database (2nd paragraph of my post), it indeed starts by rebuilding the index before syncing and getting rather fast to the corruption point. I've already witnessed a rebuild+sync case and this is not what seems to be happening.

Here, it does exactly what it did the first time I launched it. It writes "Syncing with the network ..." and starts 7 years 4x weeks ago (and progresses normally). Also, It does not display any error message (which it did when the database was corrupted).

Thx.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
December 16, 2016, 04:18:49 PM
 #4

Can you post the debug.log file?

kaicrypzen (OP)
Hero Member
*****
Offline Offline

Activity: 1344
Merit: 656



View Profile
December 16, 2016, 04:40:33 PM
 #5

Can you post the debug.log file?

My computer restarted yesterday, the debug.log file has logs from only today. The majority of the lines is like:

Code:
2016-12-16 09:37:48 UpdateTip: new best=000000000001110a03b89e33a6c0d71f89319cc1215997406bbc74ed9a6b12f4 height=108001 version=0x00000001 log2_work=59.960423 tx=270029 date='2011-02-14 08:04:01' progress=0.000816 cache=0.0MiB(17tx)

Following this unique message:

Code:
Tip: new best=0000000000012f5237dc42cf024a535900dab356928222f6087a0f3fdb639de5 height=107162 version=0x00000001 log2_work=59.834601 tx=261253 date='2011-02-09 23:21:34' progress=0.000789 cache=19.9MiB(111905tx)

And there are logs corresponding to when I stopped it properly and launched it.

Also, there are two:

Code:
socket recv error

Is there something particular to look for?

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
December 16, 2016, 04:51:20 PM
 #6

My computer restarted yesterday, the debug.log file has logs from only today.
Why would that be the case? The log files are persistent and stored on disk, they should not be deleted between starts of the computer, or of the software.

That your log files are deleted between starts and that you constantly have to redownload seems to indicate that something is deleting your datadir and Bitcoin Core has to recreate it every time it starts up.

Is there something particular to look for?
Any errors. Pay attention to anything regarding the data directory and blocks folder. You should also look at the lines that are logged when you start up Bitcoin Core and see what it says about the initial state and whether that matches your settings.

kaicrypzen (OP)
Hero Member
*****
Offline Offline

Activity: 1344
Merit: 656



View Profile
December 17, 2016, 03:16:40 PM
 #7

My computer restarted yesterday, the debug.log file has logs from only today.
Why would that be the case? The log files are persistent and stored on disk, they should not be deleted between starts of the computer, or of the software.

That your log files are deleted between starts and that you constantly have to redownload seems to indicate that something is deleting your datadir and Bitcoin Core has to recreate it every time it starts up.

Today I stopped my computer (after exiting Bitcoin Core properly), and I just started it. I examined ...AppData/Roaming/Bitcoin, the database dir was not present and debug.log contained logs from yesterday. I started Bitcoin Core, it started syncing where it left before the shutdown; I then examined ...AppData/Roaming/Bitcoin, database dir was created and debug.log contains only logs from today (yesterday's logs are no longer there).

It seems that when I start Bitcoin Core the debug.log only keeps today's logs (or something similar), is this possible? Any conf option that would be responsible for that?

Concerning the syncing from scratch, it doesn't seem like the restart was the problem, but rather that it happened when Bitcoin Core was running, which means, it (BC) didn't exit properly.

Moreover, the last time the resyncing happened, blk files were already present ...
 
Is there something particular to look for?
Any errors. Pay attention to anything regarding the data directory and blocks folder. You should also look at the lines that are logged when you start up Bitcoin Core and see what it says about the initial state and whether that matches your settings.

Concerning my settings, the majority of them are the default ones, I only unchecked Allow incoming connections in the Network tab. Any idea on which settings to verify?

Thx.

PS: In order to reproduce, I would've to stop my computer while BC is running, I just don't wanna do that and risk losing some days (blockchain years) of syncing.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
December 17, 2016, 03:33:58 PM
 #8

Today I stopped my computer (after exiting Bitcoin Core properly), and I just started it. I examined ...AppData/Roaming/Bitcoin, the database dir was not present and debug.log contained logs from yesterday. I started Bitcoin Core, it started syncing where it left before the shutdown; I then examined ...AppData/Roaming/Bitcoin, database dir was created and debug.log contains only logs from today (yesterday's logs are no longer there).

It seems that when I start Bitcoin Core the debug.log only keeps today's logs (or something similar), is this possible? Any conf option that would be responsible for that?
The database folder should disappear after you shut down Bitcoin Core. That is expected behavior. What is not expected is clearing the debug.log. I don't know of anything that would cause the debug.log to be cleared on startup.

Concerning the syncing from scratch, it doesn't seem like the restart was the problem, but rather that it happened when Bitcoin Core was running, which means, it (BC) didn't exit properly.
It should only be reindexing and warning you that it is reindexing. That it does reindex when you don't exit Bitcoin Core improperly is not surprising, although this behavior should have already been fixed.

Moreover, the last time the resyncing happened, blk files were already present ...
Next time that happens, watch your network traffic. If you look at the task manager, there should be something there to watch your network traffic. You can also go to the debug window and there is a tab for Network Traffic. If you actually are resynching, you should see that that you are suddenly receiving a ton of data and that there is a lot of network traffic. If you are not, then you are reindexing instead of resynching.

kaicrypzen (OP)
Hero Member
*****
Offline Offline

Activity: 1344
Merit: 656



View Profile
December 17, 2016, 04:40:33 PM
 #9

The database folder should disappear after you shut down Bitcoin Core. That is expected behavior. What is not expected is clearing the debug.log. I don't know of anything that would cause the debug.log to be cleared on startup.

Okay, I will surely restart everything again to see if this behavior is consistent.

It should only be reindexing and warning you that it is reindexing.

Yes, this happened when the database got corrupted upon the false postivie detection, it asked me and I said ok and it clearly displayed something like (Re)building index and after that started syncing.

That it does reindex when you don't exit Bitcoin Core improperly is not surprising, although this behavior should have already been fixed.

I would've loved it to rebuild the index Smiley, however it just started syncing from scratch (this happened twice).


Moreover, the last time the resyncing happened, blk files were already present ...
Next time that happens, watch your network traffic. If you look at the task manager, there should be something there to watch your network traffic. You can also go to the debug window and there is a tab for Network Traffic. If you actually are resynching, you should see that that you are suddenly receiving a ton of data and that there is a lot of network traffic. If you are not, then you are reindexing instead of resynching.

I will actually be more vigilant for this not to happen again Smiley. Too much wasted time. If this happens again (I think I can make it happen, actually I don't know if it's better to try to reproduce it and report an issue ...), I'll check the traffic, yet I expect it to tell me what it's doing as it did before.

Thank you very much.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!