Skip to content

Error handling in PortsOrch::initializePriorityGroupsBulk() #3961

@sreeiyer-1

Description

@sreeiyer-1

This is about the PortsOrch::initializePriorityGroupsBulk() in

void PortsOrch::initializePriorityGroupsBulk(std::vector<Port>& ports)

While working on a new platform that has limited support for priority groups in syncd, we noticed that orchagent hits an exception while processing the SAI_PORT_ATTR_INGRESS_PRIORITY_GROUP_LIST (line 6447). This happens both in cases where the bulk call get_ports_attribute is not supported in syncd or if get_ports_attribute returns the SAI_PORT_ATTR_NUMBER_OF_INGRESS_PRIORITY_GROUPS as 0 to the orchagent.

In both cases, the processing of the reply for SAI_PORT_ATTR_NUMBER_OF_INGRESS_PRIORITY_GROUPS happens successfully (it does not hit the exception in #6407). But in the priority groups list get below, port.m_priority_group_ids.size() is 0, attr.value.objlist.count is not updated. The status remains SAI_STATUS_NOT_EXECUTED and the runtime_error terminates the orchagent.

// Query ingress priority groups lists
{
    PortBulker bulker(portCount);

    for (auto& port: ports)
    {
        sai_attribute_t attr;

        if (port.m_priority_group_ids.size() == 0)
        {
            continue;
        }

        attr.id = SAI_PORT_ATTR_INGRESS_PRIORITY_GROUP_LIST;
        attr.value.objlist.list = port.m_priority_group_ids.data();
        attr.value.objlist.count = static_cast<uint32_t>(port.m_priority_group_ids.size());
        bulker.add(port.m_port_id, attr);
    }

    bulker.executeGet();

    for (size_t idx = 0; idx < portCount; idx++)
    {
        const auto& port = ports[idx];
        const auto status = bulker.statuses[idx];

        if (status != SAI_STATUS_SUCCESS)
        {
            SWSS_LOG_ERROR("Fail to get priority group list for port %s rv:%d", port.m_alias.c_str(), status);
            handleSaiGetStatus(SAI_API_PORT, status);
            throw runtime_error("PortsOrch initialization failure.");
        }

This is the log where the get_ports_attribute() was not implemented in Syncd. When we added it and returned the number of groups as 0, orchagent again failed in the same way. The error message from the syncd is for the number_of_ingress_priority_groups, the ingress_priority_group_list does not reach the syncd.

2025 Oct 29 01:47:21.799773 sonic WARNING syncd#syncd#syncd: :- processBulkOidGet: bulkGet api is not implemented or not supported, object_type = SAI_OBJECT_TYPE_PORT
2025 Oct 29 01:47:21.816217 sonic ERR swss#orchagent: :- initializePriorityGroupsBulk: Fail to get priority group list for port Ethernet0 rv:-23
2025 Oct 29 01:47:21.816217 sonic NOTICE swss#orchagent: :- handleSaiGetStatus: Encountered failure in GET operation, SAI API: SAI_API_PORT, status: SAI_STATUS_NOT_EXECUTED
2025 Oct 29 01:47:21.817063 sonic INFO swss#supervisord: orchagent terminate called after throwing an instance of 'std::runtime_error'
2025 Oct 29 01:47:21.817934 sonic INFO swss#supervisord: orchagent what(): PortsOrch initialization failure.
2025 Oct 29 01:47:22.697294 sonic INFO swss#supervisord 2025-10-29 01:47:22,696 INFO exited: swssconfig (exit status 0; expected)
2025 Oct 29 01:47:23.615716 sonic INFO swss#supervisord 2025-10-29 01:47:23,615 WARN exited: orchagent (terminated by SIGABRT (core dumped); not expected)
2025 Oct 29 01:47:23.621908 sonic INFO swss#supervisor-proc-exit-listener: Process 'orchagent' exited unexpectedly. Terminating supervisor 'swss'

Metadata

Metadata

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