Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(2708): Better error handling in orbitdb to mitigate cascading crashes #2747

Merged
merged 13 commits into from
Feb 17, 2025

Conversation

islathehut
Copy link
Collaborator

Pull Request Checklist

  • I have linked this PR to a related GitHub issue.
  • I have added a description of the change (and Github issue number, if any) to the root CHANGELOG.md.

(Optional) Mobile checklist

Please ensure you completed the following checks if you did any changes to the mobile package:

  • I have run e2e tests for mobile
  • I have updated base screenshots for visual regression tests

@islathehut islathehut changed the base branch from develop to 4.0.0 February 13, 2025 23:58
@islathehut islathehut force-pushed the fix/2708-cascading-crashes branch from ccb1950 to 9d255e7 Compare February 14, 2025 16:20
@islathehut islathehut requested a review from adrastaea February 14, 2025 16:33
await (this.datastore as LevelDatastore).close()
try {
await (this.datastore as LevelDatastore).close()
await (this.datastore as LevelDatastore).db.close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we call LevelDatastore.db.close() when all the method LevelDatastore.close() does is call this.db.close()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember the issue but I had seen something about making sure the level db was actually open and closed because it could sometimes get stuck so I figured we would be cautious and verbose.

@@ -15,7 +15,9 @@
"lint-staged": "lerna run lint-staged",
"build:auth": "cd ./3rd-party/auth && pnpm install && pnpm build",
"build:noise": "cd ./3rd-party/js-libp2p-noise && npm i && npm run build",
"bootstrap": "npm run build:auth && npm run build:noise && lerna bootstrap",
"build:orbitdb": "cd ./3rd-party/orbitdb && npm i && npm run build:dist && npm run build:debug",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with orbitdbs builds, but it looks like we only have an npm script for building a debug build of orbitdb. Is that safe for production, or should we have a different process for the CD pipeline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mimics what they do in production. The build command runs both but the reason I split it out like this is because it also runs jsdoc and for some reason that was breaking windows builds in CI. If you look in node_modules for a non-submodule branch the same files are in the orbitdb dist directory so we're good.

@@ -13,7 +13,9 @@
"webpack": "webpack --env mode=development && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"webpack:prod": "webpack --env mode=production && cp ./lib/bundle.cjs ../backend-bundle/bundle.cjs",
"postinstall": "npm run applyPatches",
"applyPatches": "patch -f -p0 < ./patch/electron-fetch.patch || true && patch -f -p0 --forward --binary < ./patch/parse-duration.patch || true && patch -f -p0 --forward --binary < ./patch/parse-duration-esm.patch || true && patch -f -p0 < ./patch/ipfs-pubsub-peer-monitor.patch || true && patch -f -p0 < ./patch/itws-sink.patch || true && patch -f -p0 < ./patch/mplex.patch || true && patch -f -p0 < ./patch/upgrader.patch || true",
"applyPatches": "npm run applyPatches:it && npm run applyPatches:libp2p",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to get rid of some patches. What changed to justify that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of them were invalid, pointing at files that didn't exist.

@islathehut islathehut merged commit a877627 into 4.0.0 Feb 17, 2025
22 of 26 checks passed
@islathehut islathehut deleted the fix/2708-cascading-crashes branch February 17, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App crashes from libp2p errors
2 participants