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

Catch database assertion when item path cannot be calculated #1217

Merged
merged 3 commits into from Jan 15, 2021

Conversation

abraunegg
Copy link
Owner

  • Catch database assertion when item path cannot be calculated

* Catch database assertion when item path cannot be calculated
@abraunegg abraunegg linked an issue Jan 9, 2021 that may be closed by this pull request
@abraunegg abraunegg added this to the v2.4.10 milestone Jan 9, 2021
@abraunegg abraunegg changed the title WIP: Catch database assertion when item path cannot be calculated Catch database assertion when item path cannot be calculated Jan 9, 2021
@abraunegg
Copy link
Owner Author

Without PR:

Configuration file successfully loaded
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine ...
Initializing monitor ...
OneDrive monitor interval (seconds): 300
core.exception.AssertError@src/itemdb.d(391): Assertion failure
----------------
??:? _d_assertp [0x5581f21c1cf5]
??:? immutable(char)[] itemdb.ItemDatabase.computePath(const(char)[], const(char)[]) [0x5581f2173805]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f700]
??:? void sync.SyncEngine.uploadDirDifferences(ref const(itemdb.Item), const(immutable(char)[])) [0x5581f219fb2a]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f97e]
??:? void sync.SyncEngine.uploadDirDifferences(ref const(itemdb.Item), const(immutable(char)[])) [0x5581f219fb2a]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f97e]
??:? void sync.SyncEngine.uploadDirDifferences(ref const(itemdb.Item), const(immutable(char)[])) [0x5581f219fb2a]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f97e]
??:? void sync.SyncEngine.uploadDirDifferences(ref const(itemdb.Item), const(immutable(char)[])) [0x5581f219fb2a]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f97e]
??:? void sync.SyncEngine.uploadDirDifferences(ref const(itemdb.Item), const(immutable(char)[])) [0x5581f219fb2a]
??:? void sync.SyncEngine.uploadDifferences(ref const(itemdb.Item)) [0x5581f219f97e]
??:? void sync.SyncEngine.scanForDifferencesDatabaseScan(const(immutable(char)[])) [0x5581f219ecbd]
??:? void main.performSync(sync.SyncEngine, immutable(char)[], bool, bool, bool, long, bool, bool, bool, bool, monitor.Monitor) [0x5581f2183d44]
??:? _Dmain [0x5581f2182bb0]
std.net.curl.CurlException@std/net/curl.d(4402): A libcurl function was given a bad argument on handle null
----------------
??:? pure @safe void std.exception.bailOut!(std.net.curl.CurlException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x5581f222999a]
??:? pure @safe bool std.exception.enforce!(std.net.curl.CurlException).enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x5581f222990b]
??:? void std.net.curl.Curl._check(int) [0x5581f21ff8af]
??:? void std.net.curl.Curl.clear(etc.c.curl.CurlOption) [0x5581f21ffc5a]
??:? void std.net.curl.HTTP.clearRequestHeaders() [0x5581f21fe98f]
??:? void onedrive.OneDriveApi.shutdown() [0x5581f2187c48]
??:? _Dmain [0x5581f21831ec]

With PR:

Configuration file successfully loaded
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine ...
Initializing monitor ...
OneDrive monitor interval (seconds): 300
ERROR: A database consistency issue has been caught. A --resync is needed to rebuild the database.

* Apply same fix for all itemdb.computePath calls
Copy link
Collaborator

@norbusan norbusan left a comment

Choose a reason for hiding this comment

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

Hmmm, since all the cases of assertion check from computePath are the same, wouldn't it make sense to move the check itself into the computePath function, and exit there?

I agree that having helper functions only doing asserts, but in this case the outcome will always be a log and exit.

* code cleanup, remove duplicate code
@abraunegg
Copy link
Owner Author

Hmmm, since all the cases of assertion check from computePath are the same, wouldn't it make sense to move the check itself into the computePath function, and exit there?

I agree that having helper functions only doing asserts, but in this case the outcome will always be a log and exit.

Yes it should be a function which is done now

Copy link
Collaborator

@norbusan norbusan left a comment

Choose a reason for hiding this comment

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

Thanks, that looks much better!

@abraunegg abraunegg merged commit cef00e7 into master Jan 15, 2021
@abraunegg abraunegg deleted the fix-issue-1216 branch January 15, 2021 03:44
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notification Bar Flooded with Initializing...
2 participants