Skip to content

Conversation

OskarDamkjaer
Copy link
Contributor

@OskarDamkjaer OskarDamkjaer commented Jul 5, 2021

If the database was shut off, bolt.hasMultiDbSupport will throw which we don't handle properly. This PR catches whenever it could throw.

Our the metadata check running every 20 seconds is supposed to detect when a database connection is lost but it doesn't work properly (in part because of hasMultiDbSupport throwing). I spent a few hours trying to understand why/how it doesn't work, but didn't get anywhere and I think the whole file requires heavy refactoring. I ended up including a another call to onConnectionLost as part of the metadata check instead, so that we don't retry the websocket in eternity. It's somewhat of a scope creep and not a perfect solution, so I'm happy to drop it.

Preview @ http://crash_on_db_switch.surge.sh

@OskarDamkjaer OskarDamkjaer requested a review from jharris4 July 5, 2021 13:39
@OskarDamkjaer OskarDamkjaer changed the title Crash on db switch Prevent crash on database connection lost Jul 5, 2021
)
}
exec(action: any, put: any, store: any) {
bolt
Copy link
Contributor

Choose a reason for hiding this comment

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

just in case, we should return the promise, so that the code using these can await them if necessary...

Copy link
Contributor

@jharris4 jharris4 left a comment

Choose a reason for hiding this comment

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

LGTM

@OskarDamkjaer OskarDamkjaer merged commit 9cf99fe into neo4j:master Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants