Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Node syncing, but showing "Synced" #273

Open
amaury1093 opened this issue Nov 26, 2018 · 6 comments
Open

Node syncing, but showing "Synced" #273

amaury1093 opened this issue Nov 26, 2018 · 6 comments
Labels
Milestone

Comments

@amaury1093
Copy link
Collaborator

amaury1093 commented Nov 26, 2018

screenshot 2018-11-26 at 13 06 14

This screenshot was taken ~10s after I arrived on the TokensList page.

@Tbaut
Copy link
Collaborator

Tbaut commented Nov 26, 2018

This happened to me this week-end on mainnet, I was trying to narrow it down.
It did not happen when letting Fether launch parity itself AFAIR

@ltfschoen
Copy link
Contributor

ltfschoen commented Jan 5, 2019

I've been able to replicate the issue using Parity-Ethereum/v2.1.9-stable-af1169d2f-20181205/x86_64-macos/rustc1.30.1 by:

  1. running Parity Ethereum ./target/release/parity --chain kovan --light
  2. running Fether yarn; yarn build; yarn start
  3. killing and restarting Parity Ethereum

@ltfschoen
Copy link
Contributor

ltfschoen commented Jan 5, 2019

@amaurymartiny @Tbaut

Reproducing the Bug

Terminal 1 - Start Parity Ethereum
  • Run
./target/release/parity --chain kovan --light
Terminal 2 - Start Fether
  • Changed the contents of paritytech/fether/packages/fether-react/src/utils/withHealth.js with the
    code in this branch/commit

  • Run

yarn; yarn build;
yarn start;
  • View Developer Tools > Console
Terminal 1 - Kill Parity Ethereum
  • Press CMD+C so it stops running

  • Delete the Kovan Light Chain database so its no longer at head block

./target/release/parity --chain kovan --light db kill
Terminal 2 - Reload Fether and Clear the Developer Tools Console
  • Press CMD+R (View > Reload)

  • Go to Electron > View > Toggle Developer Tools. Change to the "Console" tab. Press CTRL+L
    (or click the icon that looks like a no entry sign)

Terminal 1 - Restart Parity Ethereum
  • Run
./target/release/parity --chain kovan --light

Debugging the Bug

  • Initially in the bottom-right corner on the accounts list page of the Fether UI it displayed 'Not connected to any peer'.

In Developer Tools it displayed the following based on my console.logs:

ws:onClose trying again in 3.82s...
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}children: {$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …}fullscreen: truehealth: {status: Symbol(LAUNCHING)}require: "connected"__proto__: Object
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}children: {$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …}fullscreen: truehealth: {status: Symbol(LAUNCHING)}require: "connected"__proto__: Object
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}children: {$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …}fullscreen: truehealth: {status: Symbol(NOPEERS)}require: "connected"__proto__: Object
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}chainName: "kovan"health: {status: Symbol(NOPEERS)}__proto__: Object
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}chainName: "kovan"health: {status: Symbol(NOPEERS)}status: Symbol(NOPEERS)__proto__: Object__proto__: Object
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}chainName: "kovan"health: status: Symbol(NOPEERS)__proto__: Object__proto__: Object
withHealth.js:236 -------------------
withHealth.js:237 
  • Then it changed to 'Synced(kovan)' for a while even though it was only at current block ~9393409 when the
    highest block was 9962807 (since I had killed the db).

In Developer Tools it continued to displayed logs including the following based on my console.logs:

...

withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  connected
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  6
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}children: {$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …}fullscreen: truehealth: {status: Symbol(GOOD)}require: "connected"__proto__: Object
withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  undefined
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  6
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}
withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  connected
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}
withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  undefined
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}

...
  • Then it changed to 'Syncing...(2%) (kovan)'

In Developer Tools it continued to displayed logs including the following based on my console.logs:


withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  connected
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962807
withHealth.js:217     percentage 1.28705215820478414485
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  6
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  undefined
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962807
withHealth.js:217     percentage 1.28705215820478414485
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  6
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  connected
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962807
withHealth.js:217     percentage 1.28705215820478414485
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  undefined
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962807
withHealth.js:217     percentage 1.28705215820478414485
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  connected
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962806
withHealth.js:217     percentage 1.2870543894899804272
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  undefined
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962806
withHealth.js:217     percentage 1.2870543894899804272
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  5
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}
withHealth.js:204 -------------------
withHealth.js:205 withHealth.js - DURING .map 

withHealth.js:206 SYNCING with:
withHealth.js:207   isParityRunning:  true
withHealth.js:208   isApiConnected:  true
withHealth.js:209   props.require (connected?):  connected
withHealth.js:210   downloadProgress:  0
withHealth.js:211   online:  true
withHealth.js:212   isClockSync:  true
withHealth.js:213   isSync:  false
withHealth.js:214   syncPayload:  {currentBlock: BigNumber, highestBlock: BigNumber, percentage: BigNumber, startingBlock: BigNumber}
withHealth.js:215     current block 9393409
withHealth.js:216     highest block 9962806
withHealth.js:217     percentage 1.2870543894899804272
withHealth.js:218     starting block 9385985
withHealth.js:219   props.health
withHealth.js:220     sync status undefined
withHealth.js:221     current block undefined
withHealth.js:222     highest block undefined
withHealth.js:223     percentage undefined
withHealth.js:224     starting block undefined
withHealth.js:225   peerCount:  7

...
  • Then if I wait until it is truly synced and it displays 'Synced (kovan)'

In Developer Tools it continued to displayed logs including the following based on my console.logs:

...

withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  connected
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  7
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {require: "connected", fullscreen: true, children: {…}, health: {…}}
withHealth.js:236 -------------------
withHealth.js:237 withHealth.js - DURING .map 

withHealth.js:238 GOOD with:
withHealth.js:239   isParityRunning:  true
withHealth.js:240   isApiConnected:  true
withHealth.js:241   props.require (connected?):  undefined
withHealth.js:242   downloadProgress:  0
withHealth.js:243   online:  true
withHealth.js:244   isClockSync:  true
withHealth.js:245   isSync:  true
withHealth.js:246   syncPayload:  undefined
withHealth.js:247     current block undefined
withHealth.js:248     highest block undefined
withHealth.js:249     percentage undefined
withHealth.js:250     starting block undefined
withHealth.js:251   props.health
withHealth.js:252     sync status undefined
withHealth.js:253     current block undefined
withHealth.js:254     highest block undefined
withHealth.js:255     percentage undefined
withHealth.js:256     starting block undefined
withHealth.js:257   peerCount:  7
withHealth.js:271 ---------------
withHealth.js:272 withHeath.js - AFTER .map 

withHealth.js:273   props {chainName: "kovan", health: {…}}

...

Observations & Questions

  • Why causes the values passed down in the props to alternate between being the following:

    • props {require: "connected", fullscreen: true, children: {…}, health: {…}}
    • props {chainName: "kovan", health: {…}}
  • Why does the value of props.require alternate between undefined and "connected", both when it is GOOD or SYNCING?

  • The value of isSync is initially true when it is GOOD, but then changes to false when it is SYNCING (due to logic in withHealth.js)

  • Why is the props.health.status always undefined?

  • All the values that we console.log when it incorrectly says that it is GOOD before it has finished (or even started) syncing
    are identical to the values that we console.log when it correctly says that it is GOOD (when it is actually synced).
    What existing or new props can we use or memoize so we can differentiate?

  • Another strange thing that I observed in the console.logs on one occasion was that when it started syncing the props.health.payload.percentage value was approx 1.5, and then it changed back to 0 again 🔨

  • Why is the value of the following props undefined when its GOOD?

    • props.health.payload.currentBlock

    • props.health.payload.highestBlock

    • props.health.payload.percentage

    • props.health.payload.startingBlock

    • Note: If when we are actually fully synced these properties had values or we saved the values instead of
      them being undefined (i.e. if percentage was 100 or thereabouts, and currentBlock was equal to
      highestBlock) then we could change the logic in withHealth.js so it enters the "if statement" associated with the
      // Syncing blocks comment. So instead of it just being if (!isSync) { ...,
      we could change it to:

if (
	!isSync || 
	!props.health ||
	props.health.status === 'GOOD' ||
	!props.health.payload ||
	props.health.payload.currentBlock < props.health.payload.highestBlock ||
  props.health.payload.percentage < 100
) {

@Tbaut
Copy link
Collaborator

Tbaut commented Jan 11, 2019

Then it changed to 'Syncing...(2%) (kovan)'

Because of this I don't think that you had the bug. I had it (also saying it's synced on Kovan whereas it was syncing Mainnet) and it remained like this.

ps: I removed the labels because they characterize the issue from OP (it's not a question) and pleasereview is reserved for PRs.

@Tbaut Tbaut modified the milestones: 0.2-beta, 0.3-beta Mainnet Jan 11, 2019
@ltfschoen ltfschoen removed their assignment Jan 22, 2019
@ltfschoen
Copy link
Contributor

In withHealth.js, we have:

          map(syncStatus => {
            if (!syncStatus) {
              return {
                isSync: true
              };
            }

So when we don't know the sync status we're saying that we're synchronised.

I think if we don't know the sync status we should say that we're no synchronised i.e. change it to isSync: false.

Perhaps the cause of this Github issue showing "Synced" when the Node is still syncing occurs because the syncStatus is undefined for some reason although the Node is still syncing.

@axelchalon
Copy link
Contributor

@ltfschoen syncStatus being false here means that we're synced. It's the result of eth_syncing

However by default we say that we're synced startWith([{ isSync: false }, undefined]). Thibaut fixed a bug in the syncing status reported by withHealth in #385 ; we should verify if we still have this bug on master now.

@Tbaut Tbaut modified the milestones: 0.3-beta Mainnet, 0.4 Mar 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants