Skip to content

[BUG] Error occurs during BDXTransferServer::Shutdown when using the Python controller due to multiple unregisters for UMH #41464

@feasel0

Description

@feasel0

When using the python controller, the following error message occurs during shutdown
ERROR:matter.native.-:src/messaging/ExchangeMgr.cpp:192: CHIP Error 0x00000007: No unsolicited message handler at src/protocols/bdx/BdxTransferServer.cpp:55

This is happening because the python controller's TestBdxTransferServer overrides the default BdxTransferServer (that which would be used by non-Python implementations), and during initialization it unregisters the unsolicited message handler for SendInit that had been registered by the default BdxTransferServer so that it can register its own protocol-wide handler instead. However when it tears down it never puts the old handler back in place, so then when the default BdxTransferServer shuts down it tries to unregister its SendInit handler but finds that there is no such handler registered anymore, so it throws an error.

This can be fixed by having the python controller's TestBdxTransferServer::Init store the existing handler before unregistering it, and then during Shutdown re-register the old handler again, thus returning things to how they were before the python controller took over. Therefore when the default BdxTransferServer does its Shutdown and tries to unregister that handler, it will be there.

The catch here is that the python controller's TestBdxTransferServer::Shutdown is never actually called. This by itself is a problem. So this must also be fixed in order to fix the above.

I will shortly submit a PR that will implement the above.

Reproduction steps

To see this error, run any of the python test scripts and look near the end of the controller log. For example:
python src/python_testing/TestBdxTransfer.py --discriminator 3456 --passcode 20202021 --commissioning-method on-network

Bug prevalence

Always

GitHub hash of the SDK that was being used

Latest master

Platform

python

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpython

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions