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

Sessions clean-up housekeeper can throw "collection modified" error #1408

Closed
Badgerati opened this issue Oct 7, 2024 · 0 comments · Fixed by #1427
Closed

Sessions clean-up housekeeper can throw "collection modified" error #1408

Badgerati opened this issue Oct 7, 2024 · 0 comments · Fixed by #1427
Assignees
Labels
Milestone

Comments

@Badgerati
Copy link
Owner

Describe the Bug

When sessions are enabled, you can sometimes periodically see the following error in the terminal/logs:

Date: 2024-10-06 15:20:00
Level: Error
ThreadId: 0
Server: DESKTOP-900K9L3
Category: OperationStopped: (:) [Invoke-PodeScriptBlock], InvalidOperationException
Message: Collection was modified; enumeration operation may not execute.
StackTrace: at <ScriptBlock>, C:\...\PowerShell\Modules\Pode\2.11.0\Private\Sessions.ps1: line 293
at Invoke-PodeScriptBlock, C:\...\PowerShell\Modules\Pode\2.11.0\Public\Utilities.ps1: line 573
at <ScriptBlock>, <No file>: line 57

This is being thrown by the following line, and the Keys needs a .Clone() adding:

foreach ($key in $store.Memory.Keys) {

Note: This isn't a new error, my guess is this has been occurring for a long time. With the added error handling and better visibility for Schedules added in 2.11.0 this is why it's cropping up now.

Platform

  • OS: Windows
  • Versions:
    • Pode: 2.11.0
    • PowerShell: 7.4.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant