Skip to content

Conversation

@dljsjr
Copy link
Member

@dljsjr dljsjr commented Oct 23, 2025

Check all that apply

Type of Change

  • Bug fix

Checklist

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have verified my changes by testing with a device or have communicated a plan for testing

Description of Change

The recent refactor to reduce memory usage also performed a normalization of variable casing; all values that are "our" data structures use snake_case names, and all values that are "their" data structures (i.e. tables that are created directly from JSON or XML bodies) use camelCase.

Since we're no longer storing the REST response bodies as-is, but just a subset of them, there are a few places where variables that used to be camelCase are now snakeCase; we addressed all of these direct accesses, but we missed a few places where we created fallback values for iteratees that might be nil.

While fixing the above, we also add empty table fallbacks to almost all iteration sites to avoid this writ-large.

Summary of Completed Tests

Tested on my personal setup, however, I believe that the crash this fixes is only reproducible on S1 bonded sets/stereo pairs, which I don't have the personal inventory to test (my only bonded-set eligible speakers are also S2 only speakers).

@github-actions
Copy link

github-actions bot commented Oct 23, 2025

Channel deleted.

@github-actions
Copy link

github-actions bot commented Oct 23, 2025

Test Results

   71 files    457 suites   0s ⏱️
2 369 tests 2 369 ✅ 0 💤 0 ❌
4 000 runs  4 000 ✅ 0 💤 0 ❌

Results for commit 8e3bc94.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 23, 2025

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 8e3bc94

@dljsjr dljsjr force-pushed the fix/sonos-nil-iteration-crash branch from b2cedb3 to 93689d5 Compare October 23, 2025 15:30
@dljsjr dljsjr force-pushed the fix/sonos-nil-iteration-crash branch from 93689d5 to 8e3bc94 Compare October 23, 2025 15:31
Copy link
Contributor

@cjswedes cjswedes left a comment

Choose a reason for hiding this comment

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

Seems like all pairs/ipairs were updated with protections against nil input. Im fine with this, but if were doing it for fields we know should never be nil when accessed, it could potentially be hiding future errors that we would only discover with user feedback rather than driver crashes.

--- time that `receive_m_search_response` will return results with a timeout.
function _ssdp_mt:multicast_m_search()
for term, _ in pairs(self.search_terms) do
for term, _ in pairs(self.search_terms or {}) do
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we may want to crash here if this is nil, since it would mean potentially not discovering devices when we should be.

@dljsjr
Copy link
Member Author

dljsjr commented Oct 23, 2025

Seems like all pairs/ipairs were updated with protections against nil input. Im fine with this, but if were doing it for fields we know should never be nil when accessed, it could potentially be hiding future errors that we would only discover with user feedback rather than driver crashes.

Yeah, I went back and forth on this a bit. Here's my take on it:

We've learned that crashes in LAN drivers like this can lead to unintended hot crash loops. While we have a variety of mitigations on place on the hub to limit the impact of these situations, they often still end up causing undue burden on the hub's resources. And we usually end up getting bug reports for this stuff anyway.

That said there's definitely still value in the early canary of the driver crash metrics, so I could see undoing this in some places being valuable.

@dljsjr dljsjr merged commit ea36616 into main Oct 27, 2025
11 checks passed
@dljsjr dljsjr deleted the fix/sonos-nil-iteration-crash branch October 27, 2025 14:45
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.

3 participants