Skip to content

Modified examples/asynchronous_batching.py can cause suspicious HTTP 500 error #726

Open

Description

@karel-rehor

Specifications

  • Client Version: 1.51.0 - unreleased
  • InfluxDB Version: 2.9.1
  • Platform: Linux - Ubuntu 24

Code sample to reproduce problem

In examples/asynchronous_batching.py modify the client instantiation to use a timeout= argument

    async with InfluxDBClientAsync(url='http://localhost:8086', token='my-token', org='my-org', timeout=30_000) as client:
        write_api = client.write_api()
   ...

Expected behavior

Should extend timeouts in underlying REST API without issue.

Actual behavior

Flakey - happens occasionally. Can run upon the following suspicious exception

Traceback (most recent call last):
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/examples/./asynchronous_batching.py", line 77, in <module>
    asyncio.run(main())
  File "/home/karl/.pyenv/versions/3.12.7/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/karl/.pyenv/versions/3.12.7/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/karl/.pyenv/versions/3.12.7/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/examples/./asynchronous_batching.py", line 73, in main
    await done
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/venv_3_12_7/lib/python3.12/site-packages/reactivex/observable/fromfuture.py", line 29, in done
    value: Any = future.result()
                 ^^^^^^^^^^^^^^^
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/examples/./asynchronous_batching.py", line 47, in async_write
    await write_api.write(bucket='my-bucket', record=batch)
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/influxdb_client/client/write_api_async.py", line 132, in write
    raise result
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/influxdb_client/service/write_service.py", line 131, in post_write_async
    return await self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/influxdb_client/_async/api_client.py", line 173, in __call_api
    response_data = await self.request(
                    ^^^^^^^^^^^^^^^^^^^
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/influxdb_client/_async/rest.py", line 280, in POST
    return (await self.request("POST", url,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/karl/bonitoo/prjs/github.com/influxdata/influxdb-client-python/influxdb_client/_async/rest.py", line 232, in request
    raise ApiException(http_resp=r)
influxdb_client.rest.ApiException: (500)
Reason: Internal Server Error
HTTP response headers: <CIMultiDictProxy('Content-Type': 'application/json; charset=utf-8', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': 'v2.9.1', 'X-Platform-Error-Code': 'internal error', 'Date': 'Tue, 27 Oct 2026 13:28:52 GMT', 'Content-Length': '90')>
HTTP response body: b'{"code":"internal error","message":"unexpected error writing points to database: timeout"}'

Additional info

Discovered while updating PR #723, but not central to that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions