我在 Google App Engine (gqueues) 上的应用程序日志中偶尔会看到“释放未锁定的锁”错误,但无法找出原因(下面是完整的堆栈跟踪)。有谁知道为什么会发生这个错误?
有趣的是,该应用程序在 python 2.7 上运行,并且 threadsafe=NO,因此根本不会发生任何锁定或锁定错误,这似乎很奇怪。
背景故事:GQueues 运行在 python2.5 上,四月初我将其迁移到 2.7 并设置了 threadsafe=True。一周以来一切正常。然后在 4 月 9 日早上,整个应用程序无法访问,并出现 500 个错误。它不断生成延迟超过 30 秒的新服务器实例。我注意到在我的日志中看到错误“无法解锁已解锁的锁”。在迁移过程中,我没有向代码添加任何锁定机制,因此我认为这是错误所指的应用程序引擎的锁定。不管怎样,我将我的应用程序回滚到仍使用 Python 2.5 的先前版本,一切都重新开始工作。
4 月晚些时候,AppEngine Downtime Notify 透露,4 月 9 日他们的终端出现了一个问题,导致 python 2.7 应用程序出现问题。 https://groups.google.com/d/topic/google-appengine-downtime-notify/QL8TmRn6Ay4/discussion
我对来自 Google 的 Christina Ilvento 进行了跟进,她认为现在回到 Python 2.7 并设置 threadsafe=True 应该没问题。我迁移回 2.7,但保留了 threadsafe=False,认为我应该给它几个星期的时间,以确保一切在 2.7 上运行良好,然后再次打开线程(我认为这是导致问题的原因)。几周来一切都工作正常,但现在即使禁用了线程,我也看到了这个“释放未锁定的锁”错误。有谁知道这是怎么回事?
克里斯蒂娜建议我在这里发帖,App Engine 团队会跟进。
release unlocked lock Traceback (most recent call last): File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch return method(*args, **kwargs) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 69, in check_login handler_method(self, *args) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/main.py", line 297, in get self.generate('main.html', template_values) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/baserequest.py", line 257, in generate self.response.out.write(template.render(path, values)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 92, in render return t.render(Context(template_dict)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/template.py", line 172, in wrap_render return orig_render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py", line 139, in render return self.template.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py", line 173, in render nodelist.append(node.render(context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py", line 257, in render return self.nodelist_true.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py", line 139, in render return self.template.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py", line 139, in render return self.template.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py", line 173, in render nodelist.append(node.render(context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py", line 139, in render return self.template.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py", line 139, in render return self.template.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 173, in render return self._render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 167, in _render return self.nodelist.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 794, in render bits.append(self.render_node(node, context)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py", line 807, in render_node return node.render(context) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py", line 136, in render values = list(values) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2312, in next return self.__model_class.from_entity(self.__iterator.next()) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2809, in next next_batch = self.__batcher.next() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2671, in next return self.next_batch(self.AT_LEAST_ONE) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2708, in next_batch batch = self.__next_batch.get_result() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result return self.__get_result_hook(self) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2450, in __query_result_hook self._batch_shared.conn.check_rpc_success(rpc) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py",
更新: 这是其中一个错误的完整回溯
46.231.181.199 - sandra.martin [15/May/2012:03:28:44 -0700] "POST /items/ HTTP/1.1" 500 1306 "http://www.gqueues.com/main?q=ag1zfmdxdWV1ZXMtaHJkciILEgdBY2NvdW50GL-psgYMCxILU2hhcmVkUXVldWUYkU4M";;;; "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0" "www.gqueues.com" ms=59858 cpu_ms=154948 api_cpu_ms=112433 cpm_usd=4.305925 instance=00c61b117cfbf1818fa4b0f779eacc7f4a9030 D 2012-05-15 05:27:45.121 postAction: reorder E 2012-05-15 05:28:44.714 release unlocked lock Traceback (most recent call last): File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch return method(*args, **kwargs) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 139, in check_login handler_method(self, *args) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/items.py", line 371, in post self.reorder() File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/items.py", line 856, in reorder QueueSyncHandler.syncQueueViewers(clientId, itemQueue) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/queuesync.py", line 197, in syncQueueViewers jsonObj['items'] = util.getJSONItems(queueItems, filter, queueViewer.type, accountObj) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 1536, in getJSONItems jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 1536, in getJSONItems jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 1536, in getJSONItems jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail) File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py", line 1481, in getJSONItems if item.hasAssignments(): File "/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/models.py", line 1512, in hasAssignments itemAssignments = Assignment.all(keys_only=True).filter('item =', self).fetch(1) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py", line 2143, in fetch return list(self.run(limit=limit, offset=offset, **kwargs)) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2809, in next next_batch = self.__batcher.next() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2671, in next return self.next_batch(self.AT_LEAST_ONE) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2708, in next_batch batch = self.__next_batch.get_result() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result return self.__get_result_hook(self) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2450, in __query_result_hook self._batch_shared.conn.check_rpc_success(rpc) File "/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1206, in check_rpc_success rpc.wait() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 533, in wait self.__rpc.Wait() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 119, in Wait rpc_completed = self._WaitImpl() File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/apiproxy.py", line 134, in _WaitImpl self.__done_event.wait() File "/base/python27_runtime/python27_dist/lib/python2.7/threading.py", line 407, in wait self.__cond.release() error: release unlocked lock
最佳答案
感谢您的报告。我们(GAE python 团队)已经意识到这个错误。可能发生的情况是,您的处理程序可能已达到请求截止日期并遇到我们在 https://developers.google.com/appengine/docs/python/runtime#The_Request_Timer 中警告的问题。 .
您能为我检查几件事吗: 1. 异常跟踪似乎不完整。如果可能的话,您可以发布完整的回溯吗? 2. 您能否检查(在日志中)遇到此问题的请求的请求时间并将其发布在此处。
编辑:我链接到的页面上的警告最近发布。
关于google-app-engine - Google App Engine python 2.7 中出现 "Release unlocked lock"错误,threadsafe=No,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10607337/