Skip to content

Conversation

kstribrnAmzn
Copy link
Member

@kstribrnAmzn kstribrnAmzn commented Aug 5, 2025

Description of changes:
Removes the default shadow queue size limit
of 1024 shadows.

Misc changes:

  • Updates to upload-artifact v4 as v3 is deprecated
  • Updates nucleus dependency version to allow for local builds on M-series macs

Why is this change necessary:
By removing bounds on the shadow queue size
users can now have more than 1024 shadows. 'Take'
operation behaviors remain the same however 'Put'
operations will no longer block as waiting for
space is not a thing.

How was this change tested:
Figuring this out now

Any additional information or context required to review the change:
The Shadow-Manager has a queue for device shadows. This queue is limited to 1024 shadows by default (but dynamically sized when <1024). This hard limit will prevent customers from having > 1024 shadows. By removing this limit we allow more shadows with likely minimal to no effect for most customers.

For customers with > 1024 shadows this will fix blocking issues which will prevent the device from updating at the cost of additional memory.

Issue #, if available:
V1876603400

Checklist:

  • Updated the README if applicable
  • Updated or added new unit tests
  • Updated or added new integration tests
  • If your code makes a remote network call, it was tested with a proxy

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kstribrnAmzn kstribrnAmzn force-pushed the unboundedShadowQueue branch from 2023c82 to 12b2979 Compare August 5, 2025 17:41
Copy link

github-actions bot commented Aug 5, 2025

Unit Tests Coverage Report

File Coverage Lines Branches
All files 83% 88% 77%

Minimum allowed coverage is 65%

Generated by 🐒 cobertura-action against 24a9987

Copy link

github-actions bot commented Aug 5, 2025

Integration Tests Coverage Report

File Coverage Lines Branches
All files 73% 76% 69%

Minimum allowed coverage is 45%

Generated by 🐒 cobertura-action against 24a9987

@kstribrnAmzn kstribrnAmzn marked this pull request as ready for review August 5, 2025 23:16
/**
* Default maximum number of queued requests.
*/
static final int MAX_CAPACITY = 1024;
Copy link
Member

Choose a reason for hiding this comment

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

I understand that we will never reach this situation, but how are we handling the case where java throws an out of memory error when shadow manager tries to put a new request to the requests map?

Copy link
Member Author

Choose a reason for hiding this comment

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

Never say never. You're right in the fact that we could hit this case. I'll take a look at the code tomorrow and try to add in a try-catch (or multiple) to account for this. The most sensible place I can see is on the put call as the map should resize when inserting an element causes it to go above load factor.

By removing bounds on the shadow queue size
users can now have more than 1024 shadows. 'Take'
operation behaviors remain the same however 'Put'
operations will no longer block as waiting for
space is not a thing.
saranyailla
saranyailla previously approved these changes Aug 14, 2025
@kstribrnAmzn
Copy link
Member Author

Closing in favor of #210.

@kstribrnAmzn kstribrnAmzn reopened this Sep 2, 2025
@kstribrnAmzn kstribrnAmzn mentioned this pull request Sep 8, 2025
2 tasks
@kstribrnAmzn kstribrnAmzn merged commit 0a5a523 into main Sep 16, 2025
7 checks passed
@kstribrnAmzn kstribrnAmzn deleted the unboundedShadowQueue branch September 16, 2025 16:31
kstribrnAmzn added a commit that referenced this pull request Sep 24, 2025
By removing bounds on the shadow queue size
users can now have more than 1024 shadows. 'Take'
operation behaviors remain the same however 'Put'
operations will no longer block as waiting for
space is not a thing.
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