You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you accidentally include binary data in the catalog, then the problem is difficult to troubleshoot as the error doesn't specify which environment/module/resource/parameter is causing the issue.
Puppetserver 8 will fail compilation and its log will contain:
2024-02-14T20:26:59.001Z ERROR [qtp1784649573-50] [puppetserver] Puppet Server Error: Failed to serialize Puppet::Resource::Catalog for 'XXX': Could not render to Puppet::Network::Format[rich_data_json]: source sequence is illegal/malformed utf-8
which is surfaced on the agent as:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Failed to serialize ...
In puppet7, puppetserver will silently downgrade to PSON (though this can be disabled with allow_pson_serialization setting). The agent will deserialize the catalog as PSON, and then report a warning when trying to cache the catalog as JSON:
# puppet agent -t
...
Info: Unable to serialize catalog to json, retrying with pson. PSON is deprecated and will be removed in a future release
There are two variations to this problem. First, the string needs to be "labeled" as UTF-8, so String#encoding should return UTF-8 and not ASCII_8BIT (aka BINARY). Second, the string needs to be valid UTF-8, so String.valid_encoding? must be true. The latter case, can easily occur when using the file function instead of binary_file.
Expected Behavior
If binary data is accidentally introduced into the catalog and is not wrapped in Binary, as can occur when using the file function, then the compilation should fail indicating which resource caused the issue.
Describe the Bug
If you accidentally include binary data in the catalog, then the problem is difficult to troubleshoot as the error doesn't specify which environment/module/resource/parameter is causing the issue.
Puppetserver 8 will fail compilation and its log will contain:
which is surfaced on the agent as:
In puppet7, puppetserver will silently downgrade to PSON (though this can be disabled with
allow_pson_serialization
setting). The agent will deserialize the catalog as PSON, and then report a warning when trying to cache the catalog as JSON:There are two variations to this problem. First, the string needs to be "labeled" as UTF-8, so
String#encoding
should returnUTF-8
and notASCII_8BIT
(akaBINARY
). Second, the string needs to be valid UTF-8, soString.valid_encoding?
must be true. The latter case, can easily occur when using thefile
function instead ofbinary_file
.Expected Behavior
If binary data is accidentally introduced into the catalog and is not wrapped in
Binary
, as can occur when using thefile
function, then the compilation should fail indicating which resource caused the issue.Steps to Reproduce
Steps to reproduce the behavior:
Environment
Additional Context
#9102
https://puppet.atlassian.net/browse/PUP-10096
https://puppetcommunity.slack.com/archives/C0W298S9G/p1707246678595899
The text was updated successfully, but these errors were encountered: