Python DatabaseError:数据库磁盘映像的格式不正确sqlite3

Python DatabaseError:数据库磁盘映像的格式不正确sqlite3,python,database,process,sqlite,multiprocessing,Python,Database,Process,Sqlite,Multiprocessing,我运行的代理服务器可以过滤客户端请求的域。 代理服务器通过包含域的sqlite本地数据库过滤这些请求,对于客户端发出的每个请求,代理服务器都会查询数据库 经过一些查询后,我发现以下错误: Traceback (most recent call last): File "./proxy.py", line 582, in run self._process() File "./proxy.py", line 567, in _process if self._process

我运行的代理服务器可以过滤客户端请求的域。 代理服务器通过包含域的sqlite本地数据库过滤这些请求,对于客户端发出的每个请求,代理服务器都会查询数据库

经过一些查询后,我发现以下错误:

Traceback (most recent call last):
  File "./proxy.py", line 582, in run
    self._process()
  File "./proxy.py", line 567, in _process
    if self._process_rlist(r):
  File "./proxy.py", line 535, in _process_rlist
    self._process_request(data)
  File "./proxy.py", line 426, in _process_request
    checking_url = DOMAINFILTER.SearchAll(site)  # DOMAINFILTER is the class that uses the database
  File "/root/PROXY/filterDomain.py", line 203, in SearchAll
    results_db = self.__local_db.find(url) # local_db is attribute of DOMAINFILTER and handles the connection to the database
  File "/root/PROXY/filterDomain.py", line 67, in find
    self.__cursor.execute(self.__statements["find_phish"], (url,)) # cursor is attribute of DOMAINFILTER and handles the cursor of the database
DatabaseError: database disk image is malformed
顺便说一句,对于每个请求,代理都会创建一个新的进程,完成后,该进程将终止


注意:
self.\u语句[“find\u phish”]
包含
r“从phishTBL中选择站点,其中url=?;”

除了通过SQLite API打开和使用数据库之外,您对数据库做了什么?你禁用了同步吗?我只会在代理启动后通过插入所有域来更新数据库,但之后我会关闭连接并再次打开它。可能是因为它在每个进程中查询数据库?SQLite应该正确处理对数据库的并发访问,除非您明确禁用了同步。你可能想读一读,看看这些是否适用于你。[如上面链接中1.0所述]我如何确定这就是问题所在?如果是,我如何处理它,使客户端发出的每个请求都能被显示的每个进程过滤,而不会损坏数据库?除了通过SQLite API打开和使用数据库之外,您是否对数据库做了其他事情?你禁用了同步吗?我只会在代理启动后通过插入所有域来更新数据库,但之后我会关闭连接并再次打开它。可能是因为它在每个进程中查询数据库?SQLite应该正确处理对数据库的并发访问,除非您明确禁用了同步。你可能想读一读,看看这些是否适用于你。[如上面链接中1.0所述]我如何确定这就是问题所在?如果是,我如何处理它,使客户端发出的每个请求都能被显示的每个进程过滤,而不会损坏数据库?