influxdb-client-python icon indicating copy to clipboard operation
influxdb-client-python copied to clipboard

atexit doesn’t work properly in batch mode: "cannot schedule new futures after interpreter shutdown"

Open bfontaine opened this issue 11 months ago • 3 comments

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

bfontaine avatar Mar 08 '24 17:03 bfontaine

looks like issues aren't addressed :(

rwader-swi avatar May 17 '24 07:05 rwader-swi

Hi @rwader-swi,

Thanks for bringing this to our attention. I appreciate you sharing your concerns with us. I have added this issue to our backlog, and we aim to address it in our next maintenance release.

We value your input as it helps us improve and ensure our software meets user needs. I'll keep you updated on our progress regarding this issue.

Best regards

bednar avatar May 17 '24 08:05 bednar

FYI I can still reproduce this issue with the latest version of the client.

Client Version: 1.46.0 Python Version: 3.11.10 InfluxDB Version: 2.7.5 Platform: Ubuntu 24.04.1 LTS

bfontaine avatar Sep 25 '24 07:09 bfontaine