マルチスレッド モジュールを含む django アプリを dotcloud にデプロイしました。このスレッドは、DB に遅いものを入れています (通常、約 3 ~ 5 秒かかります)。
仮想環境でテストすると、すべて正常に動作します。
ここに私の dotcloud.yml があります:
www:
type: python
config:
python_version: v2.7
uwsgi_enable_threads: true
db:
type: postgresql
data:
type: mongodb
ここに私のドットクラウドログがあります:
[www.0] Process Process-1:
[www.0] Traceback (most recent call last):
[www.0] File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
[www.0] self.run()
[www.0] File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
[www.0] self._target(*self._args, **self._kwargs)
[www.0] File "/home/dotcloud/current/usn/views.py", line 416, in sync_countdown
[www.0] put_current_data_to_db(user_name)
[www.0] File "/home/dotcloud/current/usn/views.py", line 429, in put_current_data_to_db
[www.0] current_client = Client.objects.get(user_name=user_name)
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/manager.py", line 131, in get
[www.0] return self.get_query_set().get(*args, **kwargs)
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 361, in get
[www.0] num = len(clone)
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 85, in __len__
[www.0] self._result_cache = list(self.iterator())
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 291, in iterator
[www.0] for row in compiler.results_iter():
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
[www.0] for rows in self.execute_sql(MULTI):
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
[www.0] cursor.execute(sql, params)
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
[www.0] return self.cursor.execute(sql, params)
[www.0] File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
[www.0] return self.cursor.execute(query, args)
[www.0] DatabaseError: server closed the connection unexpectedly
[www.0] This probably means the server terminated abnormally
[www.0] before or while processing the request.