ZeroNetX / ZeroNet

ZeroNetX - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.dev
Other
212 stars 32 forks source link

Site database rebuild fails, empty database. Unhandled exception: AttributeError: 'NoneType' object has no attribute 'get' #200

Closed slrslr closed 1 year ago

slrslr commented 1 year ago

Step 1: Please describe your environment

Step 2: Describe the problem:

I have removed some user directories and "Reload" (database) button in site menu. On F5, site shows "Loading..." .db file is small and site menu no longer show any content. So i have tried:

$ python3 ./zeronet.py dbRebuild siteaddresshere
- Starting ZeroNet...
PluginManager Plugin ZeronameElectrumNMC load error: ModuleNotFoundError: No module named 'ZeronameElectrumNMC' in PluginManager.py line 143
PluginManager Plugin Torrent load error: ModuleNotFoundError: No module named 'Torrent' in PluginManager.py line 143
- Unhandled exception: AttributeError: 'NoneType' object has no attribute 'get' in <gevent>/threadpool.py line 167 > SiteStorage.py line 178 > MergerSitePlugin.py line 260 > SiteStorage.py line 131
Traceback (most recent call last):
  File "$HOME/.local/lib/python3.9/site-packages/gevent/threadpool.py", line 167, in __run_task
    thread_result.set(func(*args, **kwargs))
  File "/zeronetxstable/src/Site/SiteStorage.py", line 178, in rebuildDb
    db_files = list(self.getDbFiles())
  File "../zeronetxstable/plugins/MergerSite/MergerSitePlugin.py", line 260, in getDbFiles
    for item in super(SiteStoragePlugin, self).getDbFiles():
  File "/zeronetxstable/src/Site/SiteStorage.py", line 131, in getDbFiles
    for file_relative_path in list(content.get("files", {}).keys()) + list(content.get("files_optional", {}).keys()):
AttributeError: 'NoneType' object has no attribute 'get'
- 'NoneType' object has no attribute 'get'

.db file certainly looks incomplete, last lines in it:

table.keyvalue.version

Idea? I have removed site's .db ZN not wanted to shutdown so i have killed it.

After start, log shows for that site:

ERROR    - Unhandled exception: AttributeError: 'NoneType' object has no attribute 'get' in <gevent>/threadpool.py line 167 > SiteStorage.py line 178 > MergerSitePlugin.py line 260 > SiteStorage.py line 131
ERROR    Site:siteaddresshere 'NoneType' object has no attribute 'get'
ERROR    - Unhandled exception: AttributeError: 'NoneType' object has no attribute 'get' in <gevent>/greenlet.py line 906 > UiWebsocket.py line 922 > util/Noparallel.py line 62 > 55 > Site.py line 491 > SiteStorage.py line 530 > 448

Zeronet dashboard newsfeed not loading btw.

When i tried to execute above mentioned dbRebuild command inside zeronet-enhanced directory, it worked without error and i see database file is reasonably large but the site is not loading db content, same as Dashboard newsfeed. Quit ZN not worked. Seen a lot of: ERROR Site:addresshere Save peer error: NOT NULL constraint failed: peer.time_response So i kill ZN and rename zeronet/data/content.db, start ZN, after like 1 hour (once it built content.db file) ZN started, Dashboard newsfeed is loading, site loading too apparently re-download mine deleted user folders. After deleting again and rebuild database. The DB is empty. Ideas please?

I think that what may help is to kill ZN (unable to quit), start and rebuild site db again.

canewsin commented 1 year ago

It's recommended to use blocklists instead of manual removal of user directories, python code is error prone. For manual removal you need to delete main content.db located in data dir 'cause content paths(including user's) are stored on that database.

slrslr commented 1 year ago

For manual removal you need to delete main content.db located in data dir

Thanks, yet this is only removal on my side and there is no way to publish change (removal of certain data/user/directories) to peers i assume.