Odoo 数据库导出错误

Odoo Database Export Error

我在 windows 10 中使用 Odoo 11 这使得它不稳定,所以我决定从 linux 启动它。

问题是当我尝试从数据库管理器导出数据库时,它给了我 500 Internal Server Error。知道哪里出了问题吗?

这是日志:

2018-07-15 07:54:29,292 6920 ERROR odoo2 odoo.addons.web.controllers.main: Database.backup Traceback (most recent call last): File "C:\Program Files\Odoo 11.0\server\odoo\tools\misc.py", line 94, in find_pg_tool return which(name, path=path) File "C:\Program Files\Odoo 11.0\server\odoo\tools\which.py", line 144, in which raise IOError(ENOENT, '%s not found' % (mode & X_OK and 'command' or 'file'), file) FileNotFoundError: [Errno 2] command not found: 'pg_dump'

在处理上述异常的过程中,又发生了一个异常:

Traceback (most recent call last):
  File "C:\Program Files\Odoo 11.0\server\odoo\addons\web\controllers\main.py", line 735, in backup
    dump_stream = odoo.service.db.dump_db(name, None, backup_format)
  File "<decorator-gen-8>", line 2, in dump_db
  File "C:\Program Files\Odoo 11.0\server\odoo\service\db.py", line 40, in if_db_mgt_enabled
    return method(self, *args, **kwargs)
  File "C:\Program Files\Odoo 11.0\server\odoo\service\db.py", line 216, in dump_db
    odoo.tools.exec_pg_command(*cmd)
  File "C:\Program Files\Odoo 11.0\server\odoo\tools\misc.py", line 122, in exec_pg_command
    prog = find_pg_tool(name)
  File "C:\Program Files\Odoo 11.0\server\odoo\tools\misc.py", line 96, in find_pg_tool
    raise Exception('Command `%s` not found.' % name)
Exception: Command `pg_dump` not found.
2018-07-15 07:54:29,800 6920 INFO odoo2 odoo.sql_db: ConnectionPool(used=2/count=4/max=64): Closed 1 connections to 'host=localhost port=5432 user=openpg password=xxxxxxxxx sslmode=prefer dbname=odoo'
2018-07-15 07:54:29,804 6920 INFO odoo2 odoo.sql_db: ConnectionPool(used=1/count=1/max=64): Closed 3 connections to 'host=localhost port=5432 user=openpg password=xxxxxxxxx sslmode=prefer dbname=odoo2'
2018-07-15 07:54:29,819 6920 INFO odoo2 werkzeug: 127.0.0.1 - - [15/Jul/2018 07:54:29] "POST /web/database/backup HTTP/1.1" 500 -
2018-07-15 07:54:29,827 6920 ERROR odoo2 werkzeug: Error on request:
Traceback (most recent call last):
  File "C:\Program Files\Odoo 11.0\python\lib\site-packages\werkzeug\serving.py", line 209, in run_wsgi
    execute(self.server.app)
  File "C:\Program Files\Odoo 11.0\python\lib\site-packages\werkzeug\serving.py", line 197, in execute
    application_iter = app(environ, start_response)
  File "C:\Program Files\Odoo 11.0\server\odoo\service\server.py", line 252, in app
    return self.app(e, s)
  File "C:\Program Files\Odoo 11.0\server\odoo\service\wsgi_server.py", line 166, in application
    return application_unproxied(environ, start_response)
  File "C:\Program Files\Odoo 11.0\server\odoo\service\wsgi_server.py", line 154, in application_unproxied
    result = handler(environ, start_response)
  File "C:\Program Files\Odoo 11.0\server\odoo\http.py", line 1304, in __call__
    return self.dispatch(environ, start_response)
  File "C:\Program Files\Odoo 11.0\server\odoo\http.py", line 1278, in __call__
    return self.app(environ, start_wrapped)
  File "C:\Program Files\Odoo 11.0\python\lib\site-packages\werkzeug\wsgi.py", line 600, in __call__
    return self.app(environ, start_response)
  File "C:\Program Files\Odoo 11.0\server\odoo\http.py", line 1472, in dispatch
    response = self.get_response(httprequest, result, explicit_session)
  File "C:\Program Files\Odoo 11.0\server\odoo\http.py", line 279, in __exit__
    self._cr.commit()
  File "C:\Program Files\Odoo 11.0\server\odoo\sql_db.py", line 155, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Program Files\Odoo 11.0\server\odoo\sql_db.py", line 375, in commit
    result = self._cnx.commit()
psycopg2.InterfaceError: connection already closed
2018-07-15 07:54:43,988 6920 INFO odoo2 werkzeug: 192.168.1.2 - - [15/Jul/2018 07:54:43] "POST /longpolling/poll HTTP/1.1" 200 -
2018-07-15 07:55:34,032 6920 INFO odoo2 werkzeug: 192.168.1.2 - - [15/Jul/2018 07:55:34] "POST /longpolling/poll HTTP/1.1" 200 -
2018-07-15 07:56:24,078 6920 INFO odoo2 werkzeug: 192.168.1.2 - - [15/Jul/2018 07:56:24] "POST /longpolling/poll HTTP/1.1" 200 -
2018-07-15 07:56:49,944 6920 INFO odoo2 odoo.addons.base.ir.ir_cron: Starting job `Mail: Fetchmail Service`.
2018-07-15 07:56:50,037 6920 INFO odoo2 odoo.addons.fetchmail.models.fetchmail: start checking for new emails on pop server PROJECTS APPLICATIONS
2018-07-15 07:56:53,536 6920 INFO odoo2 odoo.addons.fetchmail.models.fetchmail: General failure when trying to fetch mail from pop server PROJECTS APPLICATIONS.
Traceback (most recent call last):
  File "C:\Program Files\Odoo 11.0\server\odoo\addons\fetchmail\models\fetchmail.py", line 202, in fetch_mail
    pop_server = server.connect()
  File "C:\Program Files\Odoo 11.0\server\odoo\addons\fetchmail\models\fetchmail.py", line 124, in connect
    connection.pass_(self.password)
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 213, in pass_
    return self._shortcmd('PASS %s' % pswd)
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 176, in _shortcmd
    return self._getresp()
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 152, in _getresp
    raise error_proto(resp)
poplib.error_proto: b'-ERR [AUTH] Authentication failed.'
2018-07-15 07:56:53,536 6920 INFO odoo2 odoo.addons.fetchmail.models.fetchmail: start checking for new emails on pop server Recruitment 
2018-07-15 07:57:02,180 6920 INFO odoo2 odoo.addons.fetchmail.models.fetchmail: General failure when trying to fetch mail from pop server Recruitment .
Traceback (most recent call last):
  File "C:\Program Files\Odoo 11.0\server\odoo\addons\fetchmail\models\fetchmail.py", line 202, in fetch_mail
    pop_server = server.connect()
  File "C:\Program Files\Odoo 11.0\server\odoo\addons\fetchmail\models\fetchmail.py", line 124, in connect
    connection.pass_(self.password)
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 213, in pass_
    return self._shortcmd('PASS %s' % pswd)
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 176, in _shortcmd
    return self._getresp()
  File "C:\Program Files\Odoo 11.0\python\lib\poplib.py", line 152, in _getresp
    raise error_proto(resp)
poplib.error_proto: b'-ERR [AUTH] Authentication failed.'
2018-07-15 07:57:14,139 6920 INFO odoo2 werkzeug: 192.168.1.2 - - [15/Jul/2018 07:57:14] "POST /longpolling/poll HTTP/1.1" 200 -
2018-07-15 07:57:56,378 6920 INFO odoo2 odoo.addons.base.ir.ir_cron: Starting job `Event: Mail Scheduler`.
2018-07-15 07:58:04,193 6920 INFO odoo2 werkzeug: 192.168.1.2 - - [15/Jul/2018 07:58:04] "POST /longpolling/poll HTTP/1.1" 200 -

错误消息中有趣的部分是:

command not found: 'pg_dump'

这表示您需要将 PostgreSQL 的 bin 目录(默认值:C:\Program Files\PostgreSQL.4\bin)添加到您的 PATH。 作为参考,请参阅源安装/准备部分中的段落 "on Windows":https://www.odoo.com/documentation/11.0/setup/install.html#id3 请注意,如果您是 运行 Odoo 作为 [=36],则需要重新启动 Windows =] 服务,以便进程在系统环境变量中获取此更改。

截取的另一个日志包含另外两条错误消息。 第一条消息是

psycopg2.InterfaceError: connection already closed

这可能是因为是失败后的下一条语句dump/export。或者,这可能是您所指的 "instability" 的另一种症状。通常,这种错误仅在长运行 事务从数据库端被终止(例如超时)然后仍然从客户端使用时发生。

要进一步检查,请 post 另一个问题,其中包含更多详细信息,例如:观察到的错误消息、postgres 配置和 Odoo 配置文件。

第二条消息是

poplib.error_proto: b'-ERR [AUTH] Authentication failed.'

odoo\addons\fetchmail\models\fetchmail.py出来。这表明您的 Odoo 服务器的电子邮件设置中的 username/password 设置存在问题。这与稳定性或导出数据库的能力无关。