服务器 A 是 tornado,去连服务器 B 上的 PostgreSQL 数据库,刚开始没啥问题。
可是时间久了服务器 A 和服务器 B 的数据库连接就断了。
大佬们有遇到过这种情况吗?
附个错误提示:
Traceback (most recent call last):
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3756, in execute_sql
cursor = self.get_cursor()
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3704, in get_cursor
return self.get_conn().cursor()
psycopg2.InterfaceError: connection already closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xxx/.local/lib/python3.5/site-packages/tornado/web.py", line 1488, in _execute
result = self.prepare()
File "/home/xxx/cc_backend/view/__init__.py", line 217, in prepare
if not self.current_user():
File "/home/xxx/cc_backend/view/__init__.py", line 192, in current_user
return User.get_by_key(key)
File "/home/xxx/cc_backend/model/user.py", line 102, in get_by_key
return cls.get(cls.key == key)
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 4916, in get
return sq.get()
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3171, in get
return next(clone.execute())
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3223, in execute
self._qr = ResultWrapper(model_class, self._execute(), query_meta)
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 2902, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3765, in execute_sql
self.commit()
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3588, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 135, in reraise
raise value.with_traceback(tb)
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3756, in execute_sql
cursor = self.get_cursor()
File "/home/xxx/.local/lib/python3.5/site-packages/peewee.py", line 3704, in get_cursor
return self.get_conn().cursor()
peewee.InterfaceError: connection already closed
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.