Skip to content

getChanInfo() / getGroupInfo() return nullptr in CENTRAL_COMPAT CLIENT mode #159

@SamJBoyer

Description

@SamJBoyer

Description:

When Central is running, SdkSession::create() correctly detects Central's shared memory and connects in CLIENT mode with ShmemLayout::CENTRAL_COMPAT. However, several SdkSession public getters fail silently in this mode because they call ShmemSession::getNativeConfigBuffer(), which explicitly returns nullptr when the layout is CENTRAL_COMPAT (not NATIVE).

Affected methods:

SdkSession::getChanInfo() (sdk_session.cpp:1066) -- returns nullptr for all channels
SdkSession::getGroupInfo() (sdk_session.cpp:1077) -- returns nullptr for all groups
SdkSession::Impl::getChanInfoPtr() (sdk_session.cpp:1179) -- returns nullptr, breaking all bulk getters (getChannelLabels, getChannelField, getMatchingChannelIds, getChannelPositions)
SdkSession::getProtocolVersion() (sdk_session.cpp:1111) -- hardcoded return 0 for CLIENT mode
SdkSession::getProcIdent() (sdk_session.cpp:1117) -- returns empty string for CLIENT mode
Root cause:

ShmemSession::getNativeConfigBuffer() (shmem_session.cpp:1064) guards with m_impl->layout != ShmemLayout::NATIVE and returns nullptr for CENTRAL_COMPAT. But the data IS available -- ShmemSession::getChanInfo(uint32_t) (shmem_session.cpp:917) correctly handles both layouts by falling back to legacyCfg()->chaninfo[channel].

Suggested fix:

In each affected SdkSession method, after the getNativeConfigBuffer() check fails, fall back to getLegacyConfigBuffer(). For example in getChanInfo():

const auto* legacy = m_impl->shmem_session->getLegacyConfigBuffer();
if (legacy)
return &legacy->chaninfo[chan_id - 1];
For getGroupInfo(), the legacy layout uses a 2D array groupinfo[proc][group], so the instrument index from getCentralInstrumentIndex(config.device_type) is needed.

Note that setChannelSampleGroup() in CLIENT mode (sdk_session.cpp:1284) correctly uses shmem_session->getChanInfo() and works fine -- only the read-side getters are broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions