Skip to content

connect_to_chassis_by_address and add_network_chassis may perform the operation twice #85

Open

Description

@bkeryan

Bug Report

connect_to_chassis_by_address and add_network_chassis return a string, so they call the C API once to get the string size and again to get the string contents. However, these methods have side-effects, so I think both calls perform the operation.

The comments in the C API source say // Double-call seems kind of silly here, but at least this function *tries* to be idempotent., so I think we realized this was a potential problem.

Repro or Code Sample

Not provided.

Expected Behavior

Calling connect_to_chassis_by_address or add_network_chassis performs the operation once.

Current Behavior

Calling connect_to_chassis_by_address or add_network_chassis performs the operation twice.

Possible Solution

One solution is to pre-allocate a larger buffer for the string output. If this buffer is too small, then the method can either return an error or continue to do a "double call" and perform the operation twice.

Another solution is to change the C API to store the string output in thread-local storage and add another C API function (or API property) to query the last string output. This is how we fixed this problem for the DAQmx Python API: https://github.com/ni/nidaqmx-python/blob/master/generated/nidaqmx/task/collections/_ai_channel_collection.py#L49

Context

Reviewing #84

Your Environment

N/A

AB#4180255

Activity

  1. Copilot commented on Nov 23, 2026

    Copilot

    The agent encountered an error and was unable to start working on this issue: Please try again later, or contact support if the problem persists. (Request id: 8AFE:0ECE:A7432E:F9E920:6B03CF70)

  2. Copilot commented on Nov 23, 2026

    Copilot

    The agent encountered an error and was unable to start working on this issue: Please try again later, or contact support if the problem persists. (Request id: F721:0ED7:3FD9828:6009710:6B03D0C1)

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