Open-EO / Open-EO/openeo-python-driver

log details of 413 Request Entity Too Large

Open
#465 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Python
Stars
12
Forks
8
Avg merge
6d 3h
Merged PRs (30d)
4

Description

The creation of a batch job failed because the request body was too large; the client side error was:

[413] Internal: 413 Request Entity Too Large: The data value transmitted exceeds the capacity limit. (ref: r-26020608212640479fc6b11d768b8cc0)
 
Traceback (most recent call last):
File "/tmp/ipykernel_7238/2395505010.py", line 11, in <module>
  manager.run_jobs(start_job=point_extraction, job_db=job_db)
File "/home/smetsb/PycharmProjects/eo_processing/src/eo_processing/utils/jobmanager.py", line 635, in run_jobs
  self._job_update_loop(job_db=job_db, start_job=start_job, stats=stats)
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/extra/job_management/__init__.py", line 579, in _job_update_loop
  self._launch_job(start_job, df=not_started, i=i, backend_name=backend_name, stats=stats)
File "/home/smetsb/PycharmProjects/eo_processing/src/eo_processing/utils/jobmanager.py", line 467, in _launch_job
  job = start_job(
         ^^^^^^^^^^
File "/tmp/ipykernel_7238/4289727846.py", line 67, in point_extraction
  job = cube_workspace.create_job(title=file_name,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/stac_resource.py", line 160, in create_job
  return self._connection.create_job(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/connection.py", line 1815, in create_job
  response = self.post("/jobs", json=pg_with_metadata, expected_status=HTTP_201_CREATED)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/_connection.py", line 232, in post
  return self.request("post", path=path, json=json, allow_redirects=False, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/connection.py", line 687, in request
  return _request()
          ^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/connection.py", line 680, in _request
  return super(Connection, self).request(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/_connection.py", line 141, in request
  self._raise_api_error(resp)
File "/home/smetsb/miniconda3/weed3/lib/python3.12/site-packages/openeo/rest/_connection.py", line 163, in _raise_api_error
  raise OpenEoApiError(
openeo.rest.OpenEoApiError: [413] Internal: 413 Request Entity Too Large: The data value transmitted exceeds the capacity limit. (ref: r-26020608212640479fc6b11d768b8cc0)

The root cause was the typical case of large embedded GeoJSON but this is not immediately apparent because the error log in question contains no request details:

OpenEOApiException(status_code=413, code='Internal', message='413 Request Entity Too Large: The data value transmitted exceeds the capacity limit.', id='r-26020608212640479fc6b11d768b8cc0')

Traceback (most recent call last):
  File "/opt/openeo/lib/python3.11/site-packages/flask/app.py", line 915, in full_dispatch_request
    rv = self.preprocess_request()
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/flask/app.py", line 1291, in preprocess_request
    rv = self.ensure_sync(before_func)()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/openeo_driver/views.py", line 188, in _before_request
    data = request.data
           ^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/utils.py", line 100, in __get__
    value = self.fget(obj)  # type: ignore
            ^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 373, in data
    return self.get_data(parse_form_data=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 421, in get_data
    self._load_form_data()
  File "/opt/openeo/lib/python3.11/site-packages/flask/wrappers.py", line 198, in _load_form_data
    super()._load_form_data()
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 272, in _load_form_data
    self._get_stream_for_parsing(),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 299, in _get_stream_for_parsing
    return self.stream
           ^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/utils.py", line 100, in __get__
    value = self.fget(obj)  # type: ignore
            ^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wrappers/request.py", line 351, in stream
    return get_input_stream(
           ^^^^^^^^^^^^^^^^^
  File "/opt/openeo/lib/python3.11/site-packages/werkzeug/wsgi.py", line 173, in get_input_stream
    raise RequestEntityTooLarge()
werkzeug.exceptions.RequestEntityTooLarge: 413 Request Entity Too Large: The data value transmitted exceeds the capacity limit.

To avoid spending too much time on RCA is it possible to at least log:

  • which request it concerns;
  • the enforced limit and how large the body actually was?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in openeo_driver/views.py at _before_request, where request.data is accessed and Werkzeug raises RequestEntityTooLarge. Trace the request handling and existing logging to determine how to record the request identity, enforced limit, and actual body size; done means these details are available for 413 errors without exposing the full request body.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.