jimmejardine / qiqqa-open-source

The open-sourced version of the award-winning Qiqqa research management tool for Windows
GNU General Public License v3.0
366 stars 60 forks source link

Unable to open database on sync #319

Open aterhorst opened 3 years ago

aterhorst commented 3 years ago

I just upgraded to v.83s and get unexpected problem: unable to open database error. Attached = zip file of logs. Archive.zip

GerHobbelt commented 3 years ago

Thanks for bundling the logfiles; had a look and a few ERROR log lines that are unexpected and may need further investigation:

(logfile excerpts follow, minimal cleanup for readability)

20210427.233211 [Q] INFO SYNC_DATA:Downloading paper from your Web/Intranet Library (1 to go) (1/1: 100.0%)
20210427.233211 [Q] INFO +Copying down B86349F4D81F8B3B64B35ECD69739FA561E2B7
20210427.233211 [Q] ERROR Exception while downloading paper INTRANET_A4113DCA-D8A0-4F18-8236-EBD06A4C2C3E/B86349F4D81F8B3B64B35ECD69739FA561E2B7
  System.IO.FileNotFoundException
  Message: Z:\ownCloud\qiqqa\phd_references\documents\B\B86349F4D81F8B3B64B35ECD69739FA561E2B7.pdf

Is probably not related but sounds like a missing/corrupted bit of data in your libraries: does that file exist in that location? If not, can you find the exact same filename (B86349F4D81F8B3B64B35ECD69739FA561E2B7.pdf) somewhere else on your local drives? (In that case, the document PDF is not lost, but can be added to the library again)


20210427.233211 [Q] SYNC_DATA:Downloading paper from your Web/Intranet Library (0 to go) (1/0: 100.0%)
20210427.233211 [Q] INFO  +Copying down 4BF2C73B11EA29DF2E1BDB46D010AAFC5654B7
20210427.233211 [Q] ERROR Exception while downloading paper INTRANET_A4113DCA-D8A0-4F18-8236-EBD06A4C2C3E/4BF2C73B11EA29DF2E1BDB46D010AAFC5654B7
  System.IO.FileNotFoundException
  Message: Z:\ownCloud\qiqqa\phd_references\documents\4\4BF2C73B11EA29DF2E1BDB46D010AAFC5654B7.pdf

Same questions for this one.


Then there are several UI painting errors which are a tougher nut to crack; I will have to check the Qiqqa code to see if I can find how these showed up and why this might be:

20210427.233307 [Q] ERROR [34] [77.923M] InvokeInUIThread
  System.ArgumentException
  Message: Parameter is not valid.
  Source: System.Drawing
  StackTrace: ...
   at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
   at Qiqqa.Documents.PDF.PDFRendering.PDFOverlayRenderer.RenderHighlights()

sounds like trouble in the annotation overlay painting code -- now if only I knew why 🤔 🤔


Then there's this one after a while, which looks I haven't properly checked the library sync path settings as this one should never have shown up that way (a library with no sync path is perfectly legal as that is a local-only-library (NOT an "Intranet Library" type therefor) and should not be processed by any sync logic what-so-ever:

20210428.005015 [Q] ERROR Problem accessing Intranet Library for the first time. (Id: Guest, path: '', DB title: 'Guest', Description: 'This is the library that comes with your Qiqqa guest account.'
  System.ArgumentNullException
  Message: Value cannot be null.
  Parameter name: path

That's a code inspection and code fix to go.


This one gives me the willies as it is dangerous and quite unexpected:

20210428.005015 [Q] ERROR There was a problem saving the known web libraries to file C:\Users\ter053\AppData\Local\Quantisle\Qiqqa\Guest\Qiqqa.known_web_libraries
  Message: The process cannot access the file because it is being used by another process: [C:\Users\ter053\AppData\Local\Quantisle\Qiqqa\Guest\Qiqqa.known_web_libraries.redundant]

which I will have to check further.


Then we encounter this one, which 😢 looks like the same sort of inexplicable trouble @SimonDedman is having in #257 which I haven't been able to fix yet -- looks like we're running obscure networking issues in relation to SQLite there.

20210428.005019 [Q] SYNC_META: Saving sync history
20210428.005019 [Q] ERROR Database I/O failure for DB '\\Mac\Home\ownCloud\qiqqa\terrestrial_analogue\Qiqqa.LibraryMetadata.s3db'.

System.Data.SQLite.SQLiteException
Message: unable to open database file
ErrorCode: 0x0000000E
Source: System.Data.SQLite
StackTrace:    at System.Data.SQLite.SQLite3.Open()
   at System.Data.SQLite.SQLiteConnection.Open()
   at Qiqqa.DocumentLibrary.IntranetLibraryStuff.IntranetLibraryDB.GetIntranetLibraryItemsSummary()

20210428.005019 [Q] ERROR --- Diagnosis for reported problem ---
======================================

--> File Attributes:                                Normal
--> File Creation Date (UTC):                       1/18/2021 3:49:46 AM
--> File Last Changed Date (UTC):                   4/8/2021 4:41:31 AM
--> File Last Access Date (UTC):                    4/8/2021 4:42:42 AM
--> Is marked as READ ONLY:                         False
--> Is marked as OFFLINE:                           False
--> Is marked as archived:                          False
--> Is marked as HIDDEN:                            False
--> Is a SYSTEM FILE:                               False
--> Is encrypted by the operating system:           False
--> Is compressed by the operating system:          False
--> Is a mount point:                               False
--> Is temporary:                                   False
--> Is a symbolic link:                             False
--> Is a sparse file:                               False
--> Is a reparse point:                             False
--> Is not content indexed by the operating system: False
--> Is a directory:                                 False
--> Is a device:                                    False
--> Is a normal file:                               True
--> File size:                                      817152 bytes
--> Successfully scanned the entire file: length scanned = 817152 bytes
--> Successfully opened the file for WRITE ACCESS

    As this report is about a SQLite database error, it MAY be useful to search
    the Internet for generic help and/or discussion of the reported SQLite error:

    ( ref: https://sqlite.org/rescode.html )
    ( ref: https://sqlite.org/c3ref/c_abort.html )
    SQLite Error Code: 14
    Reported error code is NOT a SQLite Extended Error Code.
    SQLite HResult: -21474816018:X

      SQLite: the define constants (i.e. compile-time options): INTEROP_EXTENSION_FUNCTIONS INTEROP_FTS5_EXTENSION INTEROP_JSON1_EXTENSION INTEROP_PERCENTILE_EXTENSION INTEROP_REGEXP_EXTENSION INTEROP_SESSION_EXTENSION INTEROP_SHA1_EXTENSION INTEROP_TOTYPE_EXTENSION INTEROP_VIRTUAL_TABLE NET_46 PRELOAD_NATIVE_LIBRARY THROW_ON_DISPOSED TRACE TRACE_PRELOAD TRACE_SHARED TRACE_WARNING USE_INTEROP_DLL USE_PREPARE_V2 WINDOWS
      SQLite: the underlying SQLite core library: 3.32.1
      SQLite: SQLITE_SOURCE_ID: 2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350
      SQLite: the compile-time options: COMPILER=msvc-1900 ENABLE_API_ARMOR ENABLE_COLUMN_METADATA ENABLE_DBSTAT_VTAB ENABLE_FTS3 ENABLE_LOAD_EXTENSION ENABLE_MEMORY_MANAGEMENT ENABLE_PREUPDATE_HOOK ENABLE_RTREE ENABLE_SESSION ENABLE_STAT4 ENABLE_STMTVTAB MAX_ATTACHED=30 SOUNDEX THREADSAFE=1 USE_URI WIN32_MALLOC
      SQLite: the version of the interop SQLite assembly: 1.0.113.0
      SQLite: the unique identifier for the source checkout used to build the interop assembly: 1911e60e5ee59d01f841dbe35dfd8e5104eae8c8 2020-05-30 14:28:05 UTC
      SQLite: the compile-time options used to compile the SQLite interop assembly: CODEC EXTENSION_FUNCTIONS JSON1_EXTENSION PERCENTILE_EXTENSION REGEXP_EXTENSION SESSION_EXTENSION SHA1_EXTENSION TOTYPE_EXTENSION VERSION_NUMBER=3032001 VIRTUAL_TABLE
      SQLite: the version of the managed components: 1.0.113.0
      SQLite: the unique identifier for the source checkout used to build the managed components: 1911e60e5ee59d01f841dbe35dfd8e5104eae8c8 2020-05-30 14:28:05 UTC
      SQLite: the extra connection flags: None
      SQLite: the default connection flags: Default

      (ref: https://sqlite.org/c3ref/extended_result_codes.html )
      SQLite Extended Error Reporting has been ENABLED: SetExtendedResultCodes(true)
---------

--> VERDICT OK(?): this DOES look like a very normal file.

    HOWEVER, it may have incorrect a.k.a. 'corrupted' content, which made Qiqqa barf,
    or there's something else going on which this simply diagnosis routine
    is unable to unearth.

    Please file a report at the Qiqqa issue tracker and include this logging
    for further inspection.

==================== End of diagnostics report ============================================

20210428.005019 [Q] ERROR Unhandled Exception Handler: Something unexpected has happened, but it's okay. unable to open database file - You can continue working, but we would appreciate it if you would send us some feedback on what you were doing when this happened.
  System.Data.SQLite.SQLiteException
  Message: unable to open database file

which is very probably the spot where things went pear shaped and this issue is about.

The above is (apart from very minor edits) what I have Qiqqa reporting into the log files these days to attempt to uncover the background for this bug (which technically is unfortunately looking quite a lot like #257)

Questions

"Conclusions" thus far

The long list of checks in that last excerpt with False and True results looks very normal. What makes this one sound very much like it's #257 are the lines

--> Successfully scanned the entire file: length scanned = 817152 bytes
--> Successfully opened the file for WRITE ACCESS

in there which tell me that my latest test code, which I added to Qiqqa v83 for #257, can "fundamentally" access that remote SQLite file for read AND open-for-write-access; however, SQLite itself barfs an undetermined hairball once we actually DO let SQLite write to it. (error 14 is all over the net and is linked to poor understood network/file system sharing trouble: somehow SQLite manages to trigger an issue in SMB ("Samba") shares software logic 😢 🤔 )

I have an idea what I MAY be able to do about this (which is something along the lines of not letting SQLite write to anything that not on local disk drives ever) but that takes some software rewriting in Qiqqa.

GerHobbelt commented 3 years ago

(hit "send" and then saw that my brain had thought several words that didn't make it to the keyboard 😞 - sorry. Bit chunky but I'll leave that text as-is.)