influxdata / influxdata/influxdb-client-python
atexit doesn’t work properly in batch mode: "cannot schedule new futures after interpreter shutdown"
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 793
- Forks
- 186
- Avg merge
- 3h 2m
- Merged PRs (30d)
- 1
Description
Hello,
Specifications
- Client Version: 1.41.0
- InfluxDB Version: 2.7.5
- Platform: Ubuntu 23.10
Code sample to reproduce problem
import atexit
from influxdb_client import InfluxDBClient, Point
influxdb = InfluxDBClient(url="...", token="...", org="...")
write_api = influxdb.write_api()
@atexit.register
def close():
print("closing")
write_api.close()
influxdb.close()
write_api.write("<bucket>", record=Point("test_bf").field("test", 1))
Expected behavior
Expected output:
closing
Actual behavior
Actual output:
The batch item wasn't processed successfully because: cannot schedule new futures after interpreter shutdown
closing
As you can see the atexit handler is executed, but the error happens before.
Additional info
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Python reproducer and trace the batch write API's shutdown and atexit lifecycle. Reproduce the error on Ubuntu with the stated client and InfluxDB versions; done means the batch item is processed without the interpreter-shutdown error before the handler prints "closing".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100