Skip to content

Fixed using stale states and mm reporting errors in success cases#125

Merged
rslater-cs merged 1 commit intodevfrom
gsm-mutiple-pdn-bug
Sep 18, 2025
Merged

Fixed using stale states and mm reporting errors in success cases#125
rslater-cs merged 1 commit intodevfrom
gsm-mutiple-pdn-bug

Conversation

@rslater-cs
Copy link
Contributor

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Description

Sometimes modem manager would return an error for connection when the modem would actually connect successfully, in other cases the state sub would fill with stale state which could give the impression of being in registered state when the modem was connected. Both of these scenarios could result in a MultiplePDNConnection error which could cause the modem to no longer be useable even if the code is restarted. To avoid entering this state I have used a function to remove old bus messages so we only look at the most recent states and I have checked for the case of successful connection even if modem manager returns a connection failure.

Manual test

  • 👍 yes
  • 🙅 no

Manual test description

This one is very difficult to get, I have only seen it on bigbox-tera and the new bigbox-v1 prototype. To get this case I simply had to keep running the code, restarting the modem beforehand and hoping to see a connection error. Without this fix you will see a list of errors ending in a constant PDN error while never entering connected state if you hit the issue, with the fix applied you should only ever see normal errors and eventually end up in connected state (Multiple PDN error should not show).

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

@rslater-cs rslater-cs marked this pull request as ready for review September 11, 2025 15:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issues with stale state reporting and incorrect error handling in the GSM modem connection logic. The changes address scenarios where modem manager would report connection errors despite successful connections, and where stale state messages could cause the system to incorrectly believe it was in a registered state when actually connected.

  • Moved the purge_sub function to be available earlier in the connection flow
  • Added logic to purge stale state messages before checking modem status
  • Added a check for successful connection even when modem manager reports a failure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@corp0529 corp0529 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@rslater-cs rslater-cs merged commit d2aeb5f into dev Sep 18, 2025
@cpunt cpunt deleted the gsm-mutiple-pdn-bug branch September 30, 2025 10:29
@rslater-cs rslater-cs restored the gsm-mutiple-pdn-bug branch September 30, 2025 15:14
rslater-cs added a commit that referenced this pull request Sep 30, 2025
@rslater-cs rslater-cs mentioned this pull request Sep 30, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants