2

我在 Google App Engine (gqueues) 上的应用程序的日志中偶尔会出现“释放解锁锁”错误,并且无法弄清楚原因(下面的完整堆栈跟踪)。有谁知道为什么会发生这个错误?

有趣的是,该应用程序在 python 2.7 上,threadsafe=NO,所以会发生任何锁定或锁定错误似乎很奇怪。

背景故事:GQueues 在 python2.5 上,4 月初我将它迁移到 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 上一切正常,然后再次打开线程(我认为这是导致问题的原因)。几周前一切正常,但现在我看到这个“释放解锁锁”错误,即使禁用了线程。有谁知道这里发生了什么?

Christina 建议我在这里发帖,App Engine 团队会跟进。

释放解锁的锁
回溯(最近一次通话最后):
  文件“/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py”,第 545 行,在调度中
    返回方法(*args, **kwargs)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 69 行,在 check_login
    handler_method(self, *args)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/main.py”,第 297 行,在 get
    self.generate('main.html', template_values)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/baserequest.py”,第 257 行,在生成
    self.response.out.write(template.render(path, values))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/template.py”,第 92 行,在渲染中
    返回 t.render(上下文(template_dict))
  wrap_render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/webapp/template.py”,第 172 行
    返回 orig_render(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py”,第 139 行,在渲染中
    返回 self.template.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py”,第 173 行,在渲染中
    nodelist.append(node.render(context))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py”,第 257 行,在渲染中
    返回 self.nodelist_true.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py”,第 139 行,在渲染中
    返回 self.template.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py”,第 139 行,在渲染中
    返回 self.template.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py”,第 173 行,在渲染中
    nodelist.append(node.render(context))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py”,第 139 行,在渲染中
    返回 self.template.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/loader_tags.py”,第 139 行,在渲染中
    返回 self.template.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 173 行,在渲染中
    返回self._render(上下文)
  _render 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 167 行
    返回 self.nodelist.render(context)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 794 行,在渲染中
    bits.append(self.render_node(节点,上下文))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/__init__.py”,第 807 行,在 render_node
    返回节点。渲染(上下文)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/_internal/django/template/defaulttags.py”,第 136 行,在渲染中
    值 = 列表(值)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py”,第 2312 行,在下一个
    return self.__model_class.from_entity(self.__iterator.next())
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2809 行,在下一个
    next_batch = self.__batcher.next()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2671 行,在下一个
    返回 self.next_batch(self.AT_LEAST_ONE)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2708 行,在 next_batch
    批处理 = self.__next_batch.get_result()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py”,第 592 行,在 get_result
    返回 self.__get_result_hook(self)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2450 行,在 __query_result_hook
    self._batch_shared.conn.check_rpc_success(rpc)
  文件“/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=00c61b117cfbf1818fa4b0f779eacc7
2012-05-15 05:27:45.121
postAction:重新排序
2012-05-15 05:28:44.714
释放解锁的锁
回溯(最近一次通话最后):
  文件“/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py”,第 545 行,在调度中
    返回方法(*args, **kwargs)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 139 行,在 check_login
    handler_method(self, *args)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/items.py”,第 371 行,在帖子中
    self.reorder()
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/items.py”,第 856 行,重新排序
    QueueSyncHandler.syncQueueViewers(clientId, itemQueue)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/queuesync.py”,第 197 行,在 syncQueueViewers
    jsonObj['items'] = util.getJSONItems(queueItems, filter, queueViewer.type, accountObj)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 1536 行,在 getJSONItems
    jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 1536 行,在 getJSONItems
    jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 1536 行,在 getJSONItems
    jsonItem['subitems'] = getJSONItems(subItems, filter, type, accountObj, assignmentCompleted=assignmentCompleted, accountEmail=accountEmail)
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/controllers/util.py”,第 1481 行,在 getJSONItems
    如果 item.hasAssignments():
  文件“/base/data/home/apps/s~gqueues-hrd/gq3-7-5.358902352474055782/models.py”,第 1512 行,在 hasAssignments
    itemAssignments = Assignment.all(keys_only=True).filter('item =', self).fetch(1)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/db/__init__.py”,第 2143 行,在 fetch
    返回列表(self.run(limit=limit,offset=offset,**kwargs))
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2809 行,在下一个
    next_batch = self.__batcher.next()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2671 行,在下一个
    返回 self.next_batch(self.AT_LEAST_ONE)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2708 行,在 next_batch
    批处理 = self.__next_batch.get_result()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py”,第 592 行,在 get_result
    返回 self.__get_result_hook(self)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_query.py”,第 2450 行,在 __query_result_hook
    self._batch_shared.conn.check_rpc_success(rpc)
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py”,第 1206 行,在 check_rpc_success
    rpc.wait()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py”,第 533 行,等待中
    self.__rpc.Wait()
  文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/api/apiproxy_rpc.py”,第 119 行,等待
    rpc_completed = self._WaitImpl()
  _WaitImpl 中的文件“/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/apiproxy.py”,第 134 行
    self.__done_event.wait()
  文件“/base/python27_runtime/python27_dist/lib/python2.7/threading.py”,第 407 行,等待中
    self.__cond.release()
错误:释放未锁定的锁

4

1 回答 1

2

感谢您的报告。我们(GAE python 团队)知道这个错误。可能发生的情况是,您的处理程序可能正在达到请求截止日期并遇到我们在https://developers.google.com/appengine/docs/python/runtime#The_Request_Timer警告的问题。

您能否帮我检查几件事: 1. 异常跟踪似乎不完整。如果可能,您能否发布完整的回溯。2. 您能否检查您的请求的请求时间(在日志中)并将其发布在此处。

编辑:我链接到的页面上的警告是最近发布的。

于 2012-05-16T05:41:25.377 回答