Giter Club home page Giter Club logo

Comments (5)

koh-osug avatar koh-osug commented on June 11, 2024 1

Great! Now I see that the await db1.close() is otherwise called too early.

from orbitdb.

koh-osug avatar koh-osug commented on June 11, 2024

I can add this information from the log trace:

TimeoutError: request timed out
at maybeThrowTimeoutError (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/ipfs-core-utils/src/with-timeout-option.js:41:15)
at file:///home/foobar/Projekte/orbitdbtest/src/node_modules/ipfs-core-utils/src/with-timeout-option.js:97:9
at async Object.get (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/storage/ipfs-block.js:62:19)
at async Object.get (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/storage/composed.js:52:15)
at async get (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/oplog/log.js:128:19)
at async Promise.all (index 0)
at async traverseAndVerify (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/oplog/log.js:264:23)
at async Object.joinEntry (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/oplog/log.js:289:5)
at async task (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/database.js:145:25)
at async file:///home/foobar/Projekte/orbitdbtest/src/node_modules/p-queue/dist/index.js:118:36
Emitted 'error' event at:
at task (file:///home/foobar/Projekte/orbitdbtest/src/node_modules/@orbitdb/core/src/sync.js:227:16)
at async file:///home/foobar/Projekte/orbitdbtest/src/node_modules/p-queue/dist/index.js:118:36 {
code: 'ERR_TIMEOUT'
}

I'm using Node.js v20.11.0

from orbitdb.

haydenyoung avatar haydenyoung commented on June 11, 2024

Are the two IPFS nodes finding each other? At a preliminary glance it looks like getting blocks from ipfs is timing out.

from orbitdb.

koh-osug avatar koh-osug commented on June 11, 2024

Yes, they do. Example output (I have added a counter compared to the code above):

putting data 0
orbit.js:97putting data 1
orbit.js:97putting data 2
orbit.js:97putting data 3
orbit.js:97putting data 4
orbit.js:97putting data 5
orbit.js:97putting data 6
orbit.js:97putting data 7
orbit.js:97putting data 8
orbit.js:97putting data 9
orbit.js:116new entry 0:
 
Object {v: 2, id: "/orbitdb/zdpuAsM7GMYLUS4cmdPi5RzQoZ9aYmUXATPxNVmAFNXEgQJ5X", key: "03fc12776196808c19ef5045ddd9d13022dbac7db2db5baf78aeee7ba1306aac23", sig: "3044022010d86740993a29d8dc0423047ce207270a5c86da57…cae4b1c4a4d8803f5d78884a43f1ec4c1cb252de4eae574fc", next: Array(1), ...}
orbit.js:116new entry 1:
 
Object {v: 2, id: "/orbitdb/zdpuAsM7GMYLUS4cmdPi5RzQoZ9aYmUXATPxNVmAFNXEgQJ5X", key: "03fc12776196808c19ef5045ddd9d13022dbac7db2db5baf78aeee7ba1306aac23", sig: "3045022100cacf844a8bf7dadb044abb95da55ab951c61be41…1381d4cf897a4f66363a6b55336635daf2a156b2c04b55ef7", next: Array(1), ...}
orbit.js:116new entry 2:
 
Object {v: 2, id: "/orbitdb/zdpuAsM7GMYLUS4cmdPi5RzQoZ9aYmUXATPxNVmAFNXEgQJ5X", key: "03fc12776196808c19ef5045ddd9d13022dbac7db2db5baf78aeee7ba1306aac23", sig: "30440220694c809d5095d460e868c760ce5eb53b53355277cd…bbf7e46e8fd8fbbf046adf4d74c428e39a3113f4b675241cc", next: Array(1), ...}
orbit.js:116new entry 3:

What I can also see is that increasing the IPFSBlockStorage.defaultTimeout does not solve this. But when increasing the time interval int the promise more nodes are updated before the error is thrown.

from orbitdb.

haydenyoung avatar haydenyoung commented on June 11, 2024

Indeed, orbitdb2 is trying to fetch items from orbitdb1 after orbitdb1's ipfs connection is closed which causes orbitdb2 to still be fetching records from orbitdb1 even though there is no connection (and, hence, the underlying ipfs block get times out).

Change db2.events.on to:

db2.events.on('update', async (entry) => {
  // Full replication is achieved by explicitly retrieving all records from db1.
  // console.log("All current data:\n")
  // console.log(await db2.all())
  if ((await db2.all()).length == (await db1.all()).length) {
    db2Updated = true
  }
})

This will ensure db2 is fully in sync with db1 b(in this example) before closing the connection between the two orbitdb instances.

from orbitdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.