[SPIGOT-7161] SnakeYaml 1.32 changed the default file size limit to 3mb Created: 25/Sep/22  Updated: 25/Dec/24  Resolved: 09/Oct/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: blablubbabc Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: SnakeYaml, config

Version: This server is running CraftBukkit version dev-Spigot-4aa5ead-c2c3908 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/acdb55f9a97c6b361947405717eb710b0200e165

With the upgrade to Snakeyaml 1.32, there is now a default size limit of ~3mb: https://bitbucket.org/snakeyaml/snakeyaml/commits/440d98e2ebd586aafd9034fc74a2a47c656eb0ce

There are some plugins that use Bukkit's configuration API for storing plugin data that can exceed this new default limit. It might make sense to increase or even remove the default limit inside Bukkit (the previous limit was 100mb).

Error:

org.bukkit.configuration.InvalidConfigurationException: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.

Other alternatives could be to:

  • Rollback the upgrade.
  • Expose the file size setting to plugins.

But I think increasing the default limit will probably suffice.



 Comments   
Comment by BloodEko [ 05/Nov/22 ]

I totally agree on md_5 here. A limit just makes things more complex for little to no benefit.

Comment by md_5 [ 09/Oct/22 ]

Same as with the max aliases for collections (SPIGOT-5881) the limit has been removed to ensure compatibility. An option could be added, but I think for compatibility the default would have to be off (or high) anyway at which point I don't see a plugin toggling it on. Maybe that could change in a future major version, but on the other hand configs are more or less trusted and also developers don't like artificial limits in the API

Comment by Parker Hawke [ 02/Oct/22 ]

> I believe it would be best to expose a method which can change this limit to plugins, but importantly, not raise the default. My opinion is that there are far better solutions for data storage than using YAML, especially for files over 3MB, be it a database, 'minified' JSON flat-file, and so on. By raising the default, it doesn't discourage plugin developers from exploring an alternative.

I agree with this point and plugins should seriously be discouraged from using YAML as a means of storage. There are, however, some plugins that do make use of very large configuration files for good reason. Things such as MythicMobs or DeluxeMenus need access to extremely large config files. The reason those plugins are as popular as they are is because their extensive configurability makes the plugin rather flexible. I think if we don't expose a way to increase the limit (maybe via MemoryConfigurationOptions), we're unnecessarily handicapping thoroughly configurable plugins.

Comment by blablubbabc [ 02/Oct/22 ]

> Are you sure there was a limit at all?

You are correct, the limit as a whole is a recent addition: https://bitbucket.org/snakeyaml/snakeyaml/commits/72dfa9f1074abe2b8a6c8776bee4476b0aed02e3
It was initially at ~100k characters and later increased to 3M characters. I accidentally interpreted it as a reduction from 100M to 3M characters.

Comment by md_5 [ 01/Oct/22 ]

> (the previous limit was 100mb).

Are you sure there was a limit at all?

Can you provide a code reference. The commit you linked (which I think was not in megabytes anyway) wasn't in the prior release, it looks to be a new addition. See, eg, https://bitbucket.org/snakeyaml/snakeyaml/src/snakeyaml-1.31/src/main/java/org/yaml/snakeyaml/LoaderOptions.java

Comment by lokka30 [ 30/Sep/22 ]

I believe it would be best to expose a method which can change this limit to plugins, but importantly, not raise the default. My opinion is that there are far better solutions for data storage than using YAML, especially for files over 3MB, be it a database, 'minified' JSON flat-file, and so on. By raising the default, it doesn't discourage plugin developers from exploring an alternative.

Comment by Bjarne Koll [ 26/Sep/22 ]

If this is to be implemented, snakeyml will most likely have to be bumped to 1.33 as the current usage of it does not properly forward the yamlLoaderOptions of the yaml instance.

See: https://github.com/PaperMC/Paper/blob/master/patches/api/0397-Expose-codepoint-limit-in-YamlConfigOptions-and-incr.patch
See: https://bitbucket.org/snakeyaml/snakeyaml/pull-requests/31/issue-553-honor-code-point-limit-in
See: https://bitbucket.org/snakeyaml/snakeyaml/src/49e794037c6be07053ce930f71f9c31b09180920/src/main/java/org/yaml/snakeyaml/Yaml.java#lines-559 

Generated at Tue Mar 18 21:01:42 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.