collective / collective/haufe.requestmonitoring

using 100% trying to acquire lock

Open
#15 37 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5
Forks
7
PR merge metrics
No merged PRs in 30d

Description

We are seeing instances randomly go to 100%

With a bit of py-spy we managed to track it down to

https://github.com/collective/haufe.requestmonitoring/blob/3e1af58eeeb014a3f94aa3fc37893f68cdbf4dd2/haufe/requestmonitoring/monitor.py#L80

Most likely related we are also seeing this exception which is likely to be related.

```
ValueError: too many values to unpack (expected 2)
File "ZPublisher/WSGIPublisher.py", line 165, in transaction_pubevents
notify(pubevents.PubStart(request))
File "/app/lib/python3.9/site-packages/zope/event/__init__.py", line 32, in notify
subscriber(event)
File "/app/eggs/zope.component-5.0.1-py3.9.egg/zope/component/event.py", line 27, in dispatch
component_subscribers(event, None)
File "/app/eggs/zope.component-5.0.1-py3.9.egg/zope/component/_api.py", line 134, in subscribers
return sitemanager.subscribers(objects, interface)
File "/app/eggs/zope.interface-5.4.0-py3.9-linux-x86_64.egg/zope/interface/registry.py", line 448, in subscribers
return self.adapters.subscribers(objects, provided)
File "/app/eggs/zope.interface-5.4.0-py3.9-linux-x86_64.egg/zope/interface/adapter.py", line 899, in subscribers
subscription(*objects)
File "app/eggs/plone.rest-2.0.0a5-py3.9.egg/plone/rest/events.py", line 32, in subscriber_mark_as_api_request
mark_as_api_request(
File "app/eggs/plone.rest-2.0.0a5-py3.9.egg/plone/rest/events.py", line 18, in mark_as_api_request
service_id = lookup_service_id(method, accept)
File "app/eggs/plone.rest-2.0.0a5-py3.9.egg/plone/rest/negotiation.py", line 26, in lookup_service_id
media_types = parse_accept_header(accept)
File "app/eggs/plone.rest-2.0.0a5-py3.9.egg/plone/rest/negotiation.py", line 16, in parse_accept_header
type_, subtype = media_type.split("/")
KeyError: 3738
File "waitress/channel.py", line 428, in service
task.service()
File "waitress/task.py", line 168, in service
self.execute()
File "waitress/task.py", line 434, in execute
app_iter = self.channel.server.application(environ, start_response)
File "ZPublisher/httpexceptions.py", line 30, in __call__
return self.application(environ, start_response)
File "ZPublisher/WSGIPublisher.py", line 375, in publish_module
with transaction_pubevents(request, response):
File "contextlib.py", line 117, in __enter__
return next(self.gen)
File "ZPublisher/WSGIPublisher.py", line 221, in transaction_pubevents
notify(pubevents.PubFailure(request, exc_info, retry))
File "/app/lib/python3.9/site-packages/zope/event/__init__.py", line 32, in notify
subscriber(event)
File "/app/eggs/zope.component-5.0.1-py3.9.egg/zope/component/event.py", line 27, in dispatch
component_subscribers(event, None)
File "/app/eggs/zope.component-5.0.1-py3.9.egg/zope/component/_api.py", line 134, in subscribers
return sitemanager.subscribers(objects, interface)
File "/app/eggs/zope.interface-5.4.0-py3.9-linux-x86_64.egg/zope/interface/registry.py", line 448, in subscribers
return self.adapters.subscribers(objects, provided)
File "/app/eggs/zope.interface-5.4.0-py3.9-linux-x86_64.egg/zope/interface/adapter.py", line 899, in subscribers
subscription(*objects)
File "haufe/requestmonitoring/monitor.py", line 182, in handle_request_end
account_request(event.request, True)
File "haufe/requestmonitoring/monitor.py", line 63, in account_request
del _state[id]
```

But I can't yet work out why the ```finally``` wouldn't work in releasing the the lock. or perhaps exception is symptom rather than a cause

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.