vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Cannot read config file when upgrading to 4.3.3 #151

Closed alinaeftn closed 2 years ago

alinaeftn commented 2 years ago

Version

Which version(s) did you encounter this bug ? When trying to upgrade from 4.3.1 to 4.3.3

Context

I encountered an exception when trying to load the conf.yml file. It works fine in 4.3.1, in 4.3.3 it throws exceptions about not finding the key. We are reading the file from 4 CoroutineVerticles in an async manner and when debugging the exception it seems to be from some paralelism issues in snakeyaml.

Do you have a reproducer?

Just create two or more coroutines verticles that start in parallel and read some keys from a conf.yml file.

Steps to reproduce

  1. Create a project with two coroutine verticles or more
  2. Based on an environment variable that states the key, read the yaml object for that key from conf.yaml
  3. Start the application

Extra

Stacktrace:

2022-08-30 09:49:20.188 ERROR 1 --- i.v.c.i.ConfigRetrieverImpl : Error while scanning configuration org.yaml.snakeyaml.constructor.ConstructorException: found unconstructable recursive node in 'string', line 268, column 9: configKey: ^ at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:225) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:470) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:461) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:556) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:391) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:375) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlSeq.construct(SafeConstructor.java:534) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:480) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:461) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:556) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:480) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:461) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:556) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:480) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:461) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:556) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:174) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:158) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:491) ~[snakeyaml-1.30.jar:?] at org.yaml.snakeyaml.Yaml.load(Yaml.java:416) ~[snakeyaml-1.30.jar:?] at io.vertx.config.yaml.YamlProcessor.lambda$process$0(YamlProcessor.java:57) ~[vertx-config-yaml-4.3.3.jar:4.3.3] at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137) ~[vertx-core-4.3.3.jar:4.3.3] at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264) ~[vertx-core-4.3.3.jar:4.3.3] at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135) ~[vertx-core-4.3.3.jar:4.3.3] at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) ~[vertx-core-4.3.3.jar:4.3.3] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.78.Final.jar:4.1.78.Final] at java.lang.Thread.run(Thread.java:834) ~[?:?]

gaol commented 2 years ago

@alinaeftn could you please elaborate ?

alinaeftn commented 2 years ago

@alinaeftn could you please elaborate ?

@gaol, what do you mean? What is the information that is missing?

As I stated in the bug, we are hitting a configuration scan issue when upgrading to 4.3.3 from 4.3.1. I attached the exception trace. We are running multiple Coroutines Verticles that start in parallel and all of them are scanning the config. The config is a yaml file and we are using vertx-config-yaml.

gaol commented 2 years ago

@alinaeftn actually I was trying to ask a reproducer. no worries, I have made one at: https://github.com/gaol/tests/tree/master/vertx/config-yaml, and it can be reproduced in Java version.

alinaeftn commented 2 years ago

Thank you so much, @gaol ! Looking forward to 4.3.4 release.