Bug 52896 - Kelvin logs a "h11._util.LocalProtocolError" after a DELETE
Summary: Kelvin logs a "h11._util.LocalProtocolError" after a DELETE
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
Version: UCS@school 4.4
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: Daniel Tröder
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-11 15:04 CET by Daniel Tröder
Modified: 2021-05-03 15:44 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.011
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-03-11 15:04:22 CET
The Kelvin API returns 204 for a successful DELETE operation. The returned body must be empty, and we do not return anything. But still there is an error logged:

---------------------------------------------------------------------------
2021-02-17 12:40:36 INFO  172.17.42.1:33944 - "DELETE /ucsschool/kelvin/v1/classes/dummy/dummyclass HTTP/1.1" 204
2021-02-17 12:40:36 ERROR Exception in ASGI application
Traceback (most recent call last):
  File "/kelvin/venv/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 389, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/kelvin/venv/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
    return await self.app(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/fastapi/applications.py", line 140, in __call__
    await super().__call__(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/applications.py", line 134, in __call__
    await self.error_middleware(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 178, in __call__
    raise exc from None
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 156, in __call__
    await self.app(scope, receive, _send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/exceptions.py", line 73, in __call__
    raise exc from None
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/exceptions.py", line 62, in __call__
    await self.app(scope, receive, sender)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/routing.py", line 590, in __call__
    await route(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/routing.py", line 208, in __call__
    await self.app(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/routing.py", line 44, in app
    await response(scope, receive, send)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/responses.py", line 128, in __call__
    await send({"type": "http.response.body", "body": self.body})
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/exceptions.py", line 59, in sender
    await send(message)
  File "/kelvin/venv/lib/python3.8/site-packages/starlette/middleware/errors.py", line 153, in _send
    await send(message)
  File "/kelvin/venv/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 483, in send
    output = self.conn.send(event)
  File "/kelvin/venv/lib/python3.8/site-packages/h11/_connection.py", line 469, in send
    data_list = self.send_with_data_passthrough(event)
  File "/kelvin/venv/lib/python3.8/site-packages/h11/_connection.py", line 502, in send_with_data_passthrough
    writer(event, data_list.append)
  File "/kelvin/venv/lib/python3.8/site-packages/h11/_writers.py", line 78, in __call__
    self.send_data(event.data, write)
  File "/kelvin/venv/lib/python3.8/site-packages/h11/_writers.py", line 98, in send_data
    raise LocalProtocolError("Too much data for declared Content-Length")
h11._util.LocalProtocolError: Too much data for declared Content-Length
---------------------------------------------------------------------------

This is not a functional problem but produces insecurity for customers.
Comment 1 Daniel Tröder univentionstaff 2021-04-29 17:39:24 CEST
Found the fix in https://github.com/tiangolo/fastapi/issues/2253

[feature/kelvin e84c63d2b] Bug #52896: fix error message after delete operation

Included is a changelog entry for version 1.4.1.
Comment 2 Joerg Baach univentionstaff 2021-05-03 12:37:46 CEST
QA → All OK → Verify

- inspected code in the commmit
- created user and class through the UI
- started the fastapi server manually
- deleted the user and class through the kelvin api, got the mentioned errors
- mirrored in the fixed code, restarted server 
  - devsynced the source dir kelvin-api, linked in the missing static dir
- created and deleted users and class, no errors in the server
Comment 3 Daniel Tröder univentionstaff 2021-05-03 15:44:31 CEST
Version 1.4.1 of the Kelvin REST API has been released.