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

[BUG] Unable to parse large YAML configuration file #1024

Closed
ZeLonewolf opened this issue Sep 22, 2024 · 0 comments · Fixed by #1039
Closed

[BUG] Unable to parse large YAML configuration file #1024

ZeLonewolf opened this issue Sep 22, 2024 · 0 comments · Fixed by #1039
Labels
bug Something isn't working

Comments

@ZeLonewolf
Copy link
Contributor

When loading a large YAML config file, planetiler throws the following exception:

Exception in thread "main" org.snakeyaml.engine.v2.exceptions.YamlEngineException: The incoming YAML document exceeds the limit: 3145728 code points.
        at org.snakeyaml.engine.v2.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:304)
        at org.snakeyaml.engine.v2.scanner.ScannerImpl.checkToken(ScannerImpl.java:193)
        at org.snakeyaml.engine.v2.parser.ParserImpl$ParseIndentlessSequenceEntryKey.produce(ParserImpl.java:661)
        at org.snakeyaml.engine.v2.parser.ParserImpl.lambda$produce$1(ParserImpl.java:232)
        at java.base/java.util.Optional.ifPresent(Unknown Source)
        at org.snakeyaml.engine.v2.parser.ParserImpl.produce(ParserImpl.java:232)
        at org.snakeyaml.engine.v2.parser.ParserImpl.peekEvent(ParserImpl.java:206)
        at org.snakeyaml.engine.v2.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:57)
        at org.snakeyaml.engine.v2.comments.CommentEventsCollector$1.peek(CommentEventsCollector.java:43)
        at org.snakeyaml.engine.v2.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:135)
        at org.snakeyaml.engine.v2.comments.CommentEventsCollector.collectEvents(CommentEventsCollector.java:115)
        at org.snakeyaml.engine.v2.composer.Composer.composeScalarNode(Composer.java:244)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:206)
        at org.snakeyaml.engine.v2.composer.Composer.composeSequenceNode(Composer.java:277)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:208)
        at org.snakeyaml.engine.v2.composer.Composer.composeValueNode(Composer.java:364)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingChildren(Composer.java:343)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingNode(Composer.java:321)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:210)
        at org.snakeyaml.engine.v2.composer.Composer.composeSequenceNode(Composer.java:277)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:208)
        at org.snakeyaml.engine.v2.composer.Composer.composeValueNode(Composer.java:364)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingChildren(Composer.java:343)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingNode(Composer.java:321)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:210)
        at org.snakeyaml.engine.v2.composer.Composer.composeSequenceNode(Composer.java:277)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:208)
        at org.snakeyaml.engine.v2.composer.Composer.composeValueNode(Composer.java:364)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingChildren(Composer.java:343)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingNode(Composer.java:321)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:210)
        at org.snakeyaml.engine.v2.composer.Composer.composeSequenceNode(Composer.java:277)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:208)
        at org.snakeyaml.engine.v2.composer.Composer.composeValueNode(Composer.java:364)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingChildren(Composer.java:343)
        at org.snakeyaml.engine.v2.composer.Composer.composeMappingNode(Composer.java:321)
        at org.snakeyaml.engine.v2.composer.Composer.composeNode(Composer.java:210)
        at org.snakeyaml.engine.v2.composer.Composer.next(Composer.java:162)
        at org.snakeyaml.engine.v2.composer.Composer.getSingleNode(Composer.java:128)
        at org.snakeyaml.engine.v2.api.Load.loadOne(Load.java:110)
        at org.snakeyaml.engine.v2.api.Load.loadFromInputStream(Load.java:123)
        at com.onthegomap.planetiler.util.YAML.load(YAML.java:35)
        at com.onthegomap.planetiler.util.YAML.load(YAML.java:27)
        at com.onthegomap.planetiler.custommap.configschema.SchemaConfig.load(SchemaConfig.java:39)
        at com.onthegomap.planetiler.custommap.ConfiguredMapMain.main(ConfiguredMapMain.java:36)
        at com.onthegomap.planetiler.Main.main(Main.java:102)

This occurred for me when trying to load a 7.5mb Yaml file. Since the size of the input Yaml is known, it should be possible to get the SnakeYaml input filesize limit to match the size of the input file:

See: https://stackoverflow.com/questions/74805240/how-to-parse-large-yaml-file-in-java-or-kotlin

@ZeLonewolf ZeLonewolf added the bug Something isn't working label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant