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

Remove default JSON size limitation #520

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

dhermanconsulting
Copy link
Contributor

SUMMARY

Change allows JavaScriptSerializer to deserialize the largest possible JSON file. Otherwise large log files from chatty PowerShell scripts will exceed the default limit of 4MB and throw an exception.

No such limitation exists on async_status.py, so this brings the PowerShell script better in line with that

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

async_status.ps1

ADDITIONAL INFORMATION

If an async tasks output exceeds 4MB (The default size limit for System.Web.Script.Serialization.JavaScriptSerializer), the deserialization will fail, throwing an exception and failing the async task.

The limit is arbitrary, and is implemented by a simple integer value that the file length is compared against. There is no practical upper limit, except for system resources.

Microsoft documentation: https://learn.microsoft.com/en-us/dotnet/api/system.web.script.serialization.javascriptserializer.maxjsonlength?

Microsoft source code: https://referencesource.microsoft.com/#system.web.extensions/Script/Serialization/JavaScriptSerializer.cs

I can see no reason to maintain a hard limitation. The python equivalent of this module (async_status.py) uses Python's json library, which has no built-in hard limitation.

dhermanconsulting and others added 2 commits June 23, 2023 13:31
Change allows JavaScriptSerializer to deserialize the largest possible JSON file. Otherwise large log files from chatty PowerShell scripts will exceed the default limit of 4MB and throw an exception.

No such limitation exists on async_status.py, so this brings the PowerShell script better in line with that
Copy link
Collaborator

@jborean93 jborean93 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, I've added a changelog fragment and integration test for this particular scenario.

@jborean93 jborean93 merged commit 6a157a4 into ansible-collections:main Jun 27, 2023
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