No reference info for Addon Manager causes an exit

I did a ‘no network’ edge case install of Gramps 6.0 and got a weird result.

Started with a fresh install of Windows 10 (with no internet connection and no pre-existing Gramps User Directory), copying the GrampsAIO-6.0.0–1_win64.exe from a USB thumbdrive, installing it from the desktop with the defaults and let Gramps launch automatically.

I created a new tree and loaded it.
Imported the example.gramps (clipboarding the path) and set the media path to the clipboarded path. Clicked through few objects in the Media category view to verify the thumbnails were loading.

Then clicked the Addons toolbar icon. And Gramps instantly exited. restarting Gramps, unlocking the tree and loading it showed.

82581: ERROR: dbloader.py: line 107: Input must be bytes, bytearray, memoryview, or str: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gui\dbloader.py", line 198, in read_file
    db.load(
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\db\generic.py", line 749, in load
    self.name_formats = self._get_metadata("name_formats")
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\plugins\db\dbapi\dbapi.py", line 398, in _get_metadata
    return self.serializer.metadata_to_object(row[0])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\lib\serialize.py", line 157, in metadata_to_object
    doc = string_to_dict(string)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\GrampsAIO64-6.0.0\gramps\gen\lib\json_utils.py", line 161, in string_to_dict
    return orjson.loads(string)
           ^^^^^^^^^^^^^^^^^^^^
orjson.JSONDecodeError: Input must be bytes, bytearray, memoryview, or str: line 1 column 1 (char 0)

I think this was a case that is highly unlikely: no addons-en.json exists and no internet connection exit that would allow it to be downloaded.

See bug reports #13721 and #13722.

1 Like

I cannot see the relation with addons.

Note, maybe this could also match the time for the metadata table creation (e.g., surname list creation at the end of the session) and the default set of gramplets (around names) on dashboard for the first gramps session ?

The relation may be coincidental. The spontaneous exit occurred when clicking the Addons toolbar icon. The error related to that disappeared with the console.

The posted dialog and message were symptoms resulting from corruption after the failure. So they are only indirectly related.

By curiosity, I made some custom “stress tests” with my local ‘custom’ configuration:

Gramps version: 5.2.2 
Python version: 3.6.9 
BSDDB version: 6.1.0 (5, 3, 28) 
sqlite version: 3.22.0 (2.6.0) 
LANG: fr_FR.UTF-8
GTK version    : 3.22.30
gobject version: 3.26.1
cairo version  : (1, 16, 2)

(I know, Gramps 5.2.x should not run with python 3.6 and Gtk 3.22), but this issue is not (fully) related to GUI or python 3…

It is the first time that I see a ‘sqlite3.ProgrammingError’:

Exception ignored in: <generator object DBAPI._iter_raw_data at 0x7f66220cff10>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line 858, in _iter_raw_data
    rows = cursor.fetchmany()
  File "/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/sqlite.py", line 219, in __exit__
    self.__cursor.close()
sqlite3.ProgrammingError: Cannot operate on a closed database.
2025-03-22 20:13:42.853: ERROR: grampsapp.py: line 190: Unhandled exception
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gramps/gui/viewmanager.py", line 968, in view_changed
    self.__change_page(page_num)
  File "/usr/lib/python3/dist-packages/gramps/gui/viewmanager.py", line 984, in __change_page
    self.active_page.set_active()
  File "/usr/lib/python3/dist-packages/gramps/gui/views/listview.py", line 317, in set_active
    NavigationView.set_active(self)
  File "/usr/lib/python3/dist-packages/gramps/gui/views/navigationview.py", line 151, in set_active
    PageView.set_active(self)
  File "/usr/lib/python3/dist-packages/gramps/gui/views/pageview.py", line 363, in set_active
    self.build_tree()
  File "/usr/lib/python3/dist-packages/gramps/gui/views/listview.py", line 350, in build_tree
    sort_map=self.column_order(),
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/peoplemodel.py", line 641, in __init__
    sort_map=sort_map,
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/treebasemodel.py", line 368, in __init__
    self.rebuild_data(self.current_filter, skip=skip)
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/treebasemodel.py", line 526, in rebuild_data
    self._build_data(self.current_filter, None, skip)
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/treebasemodel.py", line 596, in _rebuild_filter
    dfilter, skip, items, self.gen_cursor, self.map, self.add_row
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/treebasemodel.py", line 639, in __rebuild_filter
    add_func(handle, data)
  File "/usr/lib/python3/dist-packages/gramps/gui/views/treemodels/peoplemodel.py", line 675, in add_row
    group_name = ngn(self.db, name_data)
  File "/usr/lib/python3/dist-packages/gramps/gen/display/name.py", line 1176, in name_grouping_data
    _raw_primary_surname_only(pn[_SURNAME_LIST])
  File "/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/dbapi.py", line 399, in get_name_group_mapping
    self.dbapi.execute("SELECT grouping FROM name_group WHERE name = ?", [key])
  File "/usr/lib/python3/dist-packages/gramps/plugins/db/dbapi/sqlite.py", line 136, in execute
    self.__cursor.execute(*args, **kwargs)
sqlite3.ProgrammingError: Cannot operate on a closed database.

So, against 5.2.(2), but I suppose this can happen on most versions?
I am not sure where (or if) I should provide a bug report.

J.

If need, the related DEBUG log:

2025-03-22 20:13:42.793: DEBUG: sqlite.py: line 135: ('UPDATE metadata SET value = ? WHERE setting = ?', [b'\x80\x03K\x00.', 'omap_index'])
2025-03-22 20:13:42.793: DEBUG: dbapi.py: line 258:     DBAPI 0x7f66481c21d0 transaction commit
2025-03-22 20:13:42.793: DEBUG: sqlite.py: line 164: COMMIT;
2025-03-22 20:13:42.801: DEBUG: dbapi.py: line 249:     DBAPI 0x7f66481c21d0 transaction begin
2025-03-22 20:13:42.801: DEBUG: sqlite.py: line 157: BEGIN TRANSACTION;
2025-03-22 20:13:42.801: DEBUG: sqlite.py: line 135: ('BEGIN TRANSACTION;',)
2025-03-22 20:13:42.801: DEBUG: sqlite.py: line 135: ('SELECT 1 FROM metadata WHERE setting = ?', ['rmap_index'])
2025-03-22 20:13:42.802: DEBUG: sqlite.py: line 135: ('UPDATE metadata SET value = ? WHERE setting = ?', [b'\x80\x03K\x00.', 'rmap_index'])
2025-03-22 20:13:42.802: DEBUG: dbapi.py: line 258:     DBAPI 0x7f66481c21d0 transaction commit
2025-03-22 20:13:42.802: DEBUG: sqlite.py: line 164: COMMIT;
2025-03-22 20:13:42.811: DEBUG: dbapi.py: line 249:     DBAPI 0x7f66481c21d0 transaction begin
2025-03-22 20:13:42.811: DEBUG: sqlite.py: line 157: BEGIN TRANSACTION;
2025-03-22 20:13:42.811: DEBUG: sqlite.py: line 135: ('BEGIN TRANSACTION;',)
2025-03-22 20:13:42.811: DEBUG: sqlite.py: line 135: ('SELECT 1 FROM metadata WHERE setting = ?', ['nmap_index'])
2025-03-22 20:13:42.811: DEBUG: sqlite.py: line 135: ('UPDATE metadata SET value = ? WHERE setting = ?', [b'\x80\x03K\x00.', 'nmap_index'])
2025-03-22 20:13:42.811: DEBUG: dbapi.py: line 258:     DBAPI 0x7f66481c21d0 transaction commit
2025-03-22 20:13:42.812: DEBUG: sqlite.py: line 164: COMMIT;
2025-03-22 20:13:42.820: DEBUG: sqlite.py: line 194: closing database...
2025-03-22 20:13:42.822: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.persontreeview = [20.345052083333332, 23.111979166666668, 6.103515625, 8.138020833333334]
2025-03-22 20:13:42.823: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.events = [8.138020833333334, 12.20703125, 8.138020833333334, 8.138020833333334, 32.552083333333336, 16.276041666666668]
2025-03-22 20:13:42.824: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.children = [20.345052083333332, 8.138020833333334, 8.138020833333334]
2025-03-22 20:13:42.824: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.citations = [28.483072916666664, 12.20703125, 12.6953125, 16.276041666666668]
2025-03-22 20:13:42.847: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.persontreeview = [20.345052083333332, 23.111979166666668, 6.103515625, 8.138020833333334]
2025-03-22 20:13:42.848: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.events = [8.138020833333334, 12.20703125, 8.138020833333334, 8.138020833333334, 32.552083333333336, 16.276041666666668]
2025-03-22 20:13:42.848: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.children = [20.345052083333332, 8.138020833333334, 8.138020833333334]
2025-03-22 20:13:42.849: DEBUG: persistenttreeview.py: line 96: save persistent : spacing.citations = [28.483072916666664, 12.20703125, 12.6953125, 16.276041666666668]
2025-03-22 20:13:42.852: DEBUG: sqlite.py: line 135: ('SELECT grouping FROM name_group WHERE name = ?', ['Bush'])
Exception ignored in: <generator object DBAPI._iter_raw_data at 0x7f66220cff10>