Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resilient USP info handler #319

Open
leandrofars opened this issue Jul 23, 2024 · 1 comment
Open

Resilient USP info handler #319

leandrofars opened this issue Jul 23, 2024 · 1 comment
Labels
enhancement New feature or request usp issues related to usp protocol
Milestone

Comments

@leandrofars
Copy link
Member

No description provided.

@leandrofars leandrofars added enhancement New feature or request usp issues related to usp protocol labels Jul 23, 2024
@leandrofars leandrofars added this to the July milestone Jul 23, 2024
@leandrofars
Copy link
Member Author

In the process of operation, we found a situation where Oktopus stops functioning when receiving an incorrect USP message from an agent, namely:
GET_RESP on a GET Device.Deviceinfo request.
The error causes the adapter container to crash with the error:
2024/07/22 08:39:58 info.go:15: Device proto::puma7-00:50:f1:20:00:53 info, mtp: mqtt
panic: runtime error: index out of range [0] with length 0
goroutine 55 [running]:
[github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events/handler.parseDeviceInfoMsg({0xc0000f042c](http://github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events/handler.parseDeviceInfoMsg(%7B0xc0000f042c), 0x1e}, {0x40e7fb?, 0xc2490a?}, {0xc0004c0000, 0x2e8})
/app/internal/events/handler/info.go:52 +0x465
[github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events/handler.(*Handler).HandleDeviceInfo(0xc0000ca1e0](http://github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events/handler.(*Handler).HandleDeviceInfo(0xc0000ca1e0), {0xc0000f042c, 0x1e}, {0xc0000f0420, 0x2f}, {0xc0004c0000, 0x2e8} , {0xa2650c, 0x4}, ...)
/app/internal/events/handler/info.go:16 +0x20e
github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events.StartEventsListener.func1()
/app/internal/events/events.go:55 +0x486
created by github.com/OktopUSP/oktopus/backend/services/mtp/adapter/internal/events.StartEventsListener in goroutine 1
/app/internal/events/events.go:26 +0x1e5
We found the following explanation: in the module oktopus/backend/services/mtp/adapter/internal/events/handler/info.go (and in the new version it is oktopus/backend/services/mtp/adapter/internal/events/usp_handler
/info.go) an error occurs in the parsing process
device.Vendor = msg.ReqPathResults[0].ResolvedPathResults[0].ResultParams[“Manufacturer”]
device.Model = msg.ReqPathResults[1].ResolvedPathResults[0].ResultParams[“ModelName”]
device.Version = msg.ReqPathResults[2].ResolvedPathResults[0].ResultParams[“SoftwareVersion”]
device.ProductClass = msg.ReqPathResults[4].ResolvedPathResults[0].ResultParams[“ProductClass”]
Since the object msg.ReqPathResults[0].ResolvedPathResults[0] takes the value nil
In our opinion, it would be useful to add handling of such an exception to the code, as it would protect the controller and other users from incorrect behavior of one of the agents.
If necessary, we can try to provide more detailed information.
Sincerely, Oleksandr.

@leandrofars leandrofars modified the milestones: July, August Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request usp issues related to usp protocol
Projects
None yet
Development

No branches or pull requests

1 participant