Skip to content

Object IDs collide #531

Open
mpld3/mplexporter
#66
@vladh

Description

@vladh

This bug has to do with the get_id() function, which generates unique IDs for objects such as figures and elements. These IDs are used, for example, in custom plugins, via the get_element() function.

The problem is that I have encountered ID collisions, where two different objects have the same ID.

This breaks python visualize_tests.py --local, because the custom plugin JS code frequently (but not always!) retrieves incorrect elements, at which point execution stops because of an exception.

Interestingly, this bug happens only as of 2d757b1.

I have only reproduced this bug on Python 3.13.2.

Blocks #530.

Reproduction steps

  • Use Python 3.13.2 (not sure if this is required)
  • Check out 2d757b1
  • Run python visualize_tests.py --local
  • Open the console and read the error

Leads

IDs are calculated as follows:

objid = prefix + str(os.getpid()) + str(id(obj)) + suffix

The use of the id() function seems suspicious here. One possible lead:

Two objects with non-overlapping lifetimes may have the same id() value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions