lyft / presto-gateway

A load balancer / proxy / gateway for prestodb
Apache License 2.0
358 stars 156 forks source link

Fix: random ParserException with routing rules engine #198

Open regadas opened 1 year ago

regadas commented 1 year ago

I have seen random queries being submitted to the default adhoc cluster instead of the intended cluster.

After a closer look, there were actually some exceptions being thrown, i.e.

! org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
! at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:572)
! at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingFirstKey.produce(ParserImpl.java:552)
! at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
! at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
! at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:235)
! at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:162)
! at org.yaml.snakeyaml.composer.Composer.composeKeyNode(Composer.java:253)
! at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:244)
! at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:236)
! at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:162)
! at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:95)
! at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:134)
! at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:494)

The suspicion here is around reading/creating the rules on every request not being thread safe.

baiyyidsn commented 1 year ago

Hi regadas~, I encountered the same issue, and your code fix the problem, but also bring in another problem, such as the gateway can not dynamic load routing config file. And I just fixed it on my local repo