Skip to content

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

Open
@bfontaine

Description

@bfontaine

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

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