当我使用django admin时会发生这种情况。 以下是附加的2个型号 -
class Grapes(models.Model):
gmodel = HStoreField()
gfile = models.FileField()
guser = HStoreField()
posx = HStoreField()
stats = HStoreField()
create_time = models.DateTimeField(auto_now_add=True)
class Farm(models.Model):
acc = models.OneToOneField(Parent)
grapes_id = models.OneToOneField('someapp.Grapes', null=True)
field_one = models.PositiveIntegerField(default=0)
field_two = models.PositiveIntegerField(default=0)
field_three = models.PositiveIntegerField()
update_time = models.DateTimeField(auto_now=True)
每当我尝试在管理面板中访问Farm的对象时,它会从以下2个错误中返回 -
1。内存错误
(无法获取异常消息)
Traceback:
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\core\handlers\base.py" in get_response
164. response = response.render()
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\response.py" in render
158. self.content = self.rendered_content
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\response.py" in rendered_content
135. content = template.render(context, self._request)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\backends\django.py" in render
74. return self.template.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
210. return self._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
135. return compiled_parent._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
135. return compiled_parent._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
65. result = block.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
65. result = block.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
159. return template.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
212. return self._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
329. return nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
329. return nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render
92. output = force_text(output)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\utils\encoding.py" in force_text
92. s = six.text_type(s)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\utils\html.py" in <lambda>
390. klass.__unicode__ = lambda self: mark_safe(klass_unicode(self))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\forms.py" in __str__
537. return self.as_widget()
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\forms.py" in as_widget
593. return force_text(widget.render(name, self.value(), attrs=attrs))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\contrib\admin\widgets.py" in render
292. 'widget': self.widget.render(name, value, *args, **kwargs),
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\widgets.py" in render
513. options = self.render_options(choices, [value])
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\widgets.py" in render_options
539. for option_value, option_label in chain(self.choices, choices):
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\models.py" in __iter__
1107. for obj in queryset:
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\query.py" in iterator
254. for row in compiler.results_iter(results):
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\sql\compiler.py" in results_iter
797. for rows in results:
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\sql\compiler.py" in cursor_iter
1152. sentinel):
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\sql\compiler.py" in <lambda>
1151. for rows in iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)),
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\utils.py" in inner
105. return func(*args, **kwargs)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\psycopg2\extras.py" in parse_unicode
706. return self.parse(s, cur)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\psycopg2\extras.py" in parse
690. rv[k] = v
Exception Type: MemoryError at /db/app/farm/6/
Exception Value:
2。数据库错误
与服务器失去同步:获得消息类型&#34; D&#34;,长度50394230
Traceback:
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\core\handlers\base.py" in get_response
164. response = response.render()
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\response.py" in render
158. self.content = self.rendered_content
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\response.py" in rendered_content
135. content = template.render(context, self._request)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\backends\django.py" in render
74. return self.template.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
210. return self._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
135. return compiled_parent._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
135. return compiled_parent._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
65. result = block.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
65. result = block.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\loader_tags.py" in render
159. return template.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
212. return self._render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\test\utils.py" in instrumented_test_render
96. return self.nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
217. nodelist.append(node.render(context))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
329. return nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\defaulttags.py" in render
329. return nodelist.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\base.py" in render
905. bit = self.render_node(node, context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render_node
79. return node.render(context)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\template\debug.py" in render
92. output = force_text(output)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\utils\encoding.py" in force_text
92. s = six.text_type(s)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\utils\html.py" in <lambda>
390. klass.__unicode__ = lambda self: mark_safe(klass_unicode(self))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\forms.py" in __str__
537. return self.as_widget()
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\forms.py" in as_widget
593. return force_text(widget.render(name, self.value(), attrs=attrs))
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\contrib\admin\widgets.py" in render
292. 'widget': self.widget.render(name, value, *args, **kwargs),
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\widgets.py" in render
513. options = self.render_options(choices, [value])
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\widgets.py" in render_options
539. for option_value, option_label in chain(self.choices, choices):
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\forms\models.py" in __iter__
1107. for obj in queryset:
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\query.py" in iterator
238. results = compiler.execute_sql()
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql
840. cursor.execute(sql, params)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\debug_toolbar\panels\sql\tracking.py" in execute
159. return self._record(self.cursor.execute, sql, params)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\debug_toolbar\panels\sql\tracking.py" in _record
101. return method(sql, params)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\backends\utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\backends\utils.py" in execute
64. return self.cursor.execute(sql, params)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\utils.py" in __exit__
98. six.reraise(dj_exc_type, dj_exc_value, traceback)
File "D:\MOOPOI~1\Projects\Vidzert\Webiste\VIDZER~1\lib\site-packages\django\db\backends\utils.py" in execute
64. return self.cursor.execute(sql, params)
Exception Type: DatabaseError at /db/app/farm/7/
Exception Value: lost synchronization with server: got message type "D", length 50394230
或有时(罕见)只显示 -
A server error occurred. Please contact the administrator.
但是当我直接访问管理员中的Grapes对象时,它可以正常工作。我发现的唯一解决方法是将Farm模型中的grapes_id设为管理员中的只读字段。
它肯定不依赖于单个对象上Hstorefield的大小。我尝试过1000到250万个密钥的变化。
我在win7 64bit上使用postgresql 9.4,django 1.8.9和python 2.7.11 32bit。