Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-14226

Yaml Parse does not handle "flow" line breaks

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The yaml parse does not respect string line breaking in the following form:

      element: some idiot
        thought this was a good idea
      

      This is a problem for the Operator, as it serializes structs to yaml using go-libraries that automatically use the above style when a string value exceeds a certain limit. Consequently, calls to the Infinispan REST API with the below yaml fail.

      distributedCache: 
        encoding: 
          key: 
            mediaType: application/x-protostream
          value: 
            mediaType: application/x-protostream
        expiration: 
          lifespan: "36000"
        memory: 
          storage: OFF_HEAP
        mode: SYNC
        owners: "2"
        partitionHandling: 
          mergePolicy: REMOVE_ALL
          whenSplit: ALLOW_READ_WRITES
        persistence: 
          queryJdbcStore: 
            dataSource: 
              jndiUrl: jdbc/OracleDS
            dialect: ORACLE
            keyColumns: strkey
            preload: "false"
            queries: 
              deleteAll: DELETE FROM T_PROMOTION_CACHE
              deleteSingle: DELETE FROM T_PROMOTION_CACHE t1 WHERE t1.strkey = :strkey
              selectAll: SELECT T1.strkey, T1.TIMESTAMP, T1.VALUE FROM T_PROMOTION_CACHE
                T1
              selectSingle: SELECT T1.strkey , T1.TIMESTAMP, T1.VALUE FROM T_PROMOTION_CACHE
                T1 WHERE T1.strkey= :strkey
              size: SELECT COUNT(*) FROM T_PROMOTION_CACHE
              upsert: MERGE INTO T_PROMOTION_CACHE USING DUAL ON (strkey = :strkey) WHEN
                MATCHED THEN UPDATE SET timestamp= :timestamp , value= :value where strkey
                = :strkey WHEN NOT MATCHED THEN INSERT (strkey,timestamp,value) VALUES(:strkey,:timestamp,:value)
            readOnly: "false"
            schema: 
              embeddedKey: "false"
              messageName: ProtoSchema
              package: org.example.protobufschema
            segmented: "false"
            shared: "true"
        statistics: "true"
      

      Infinispan server:

      21:08:05,688 ERROR (blocking-thread--p3-t3) [org.infinispan.rest.RestRequestHandler] ISPN012005: An error occurred while responding to the client java.util.concurrent.CompletionException: org.infinispan.commons.CacheConfigurationException: org.infinispan.commons.configuration.io.ConfigurationReaderException: Incomplete line[27,1]
      	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
      	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1702)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: org.infinispan.commons.CacheConfigurationException: org.infinispan.commons.configuration.io.ConfigurationReaderException: Incomplete line[27,1]
      	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:163)
      	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:145)
      	at org.infinispan.rest.resources.CacheResourceV2.lambda$convert$5(CacheResourceV2.java:333)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
      	... 5 more
      Caused by: org.infinispan.commons.configuration.io.ConfigurationReaderException: Incomplete line[27,1]
      	at org.infinispan.commons.configuration.io.yaml.YamlConfigurationReader.parseLine(YamlConfigurationReader.java:315)
      	at org.infinispan.commons.configuration.io.yaml.YamlConfigurationReader.loadTree(YamlConfigurationReader.java:127)
      	at org.infinispan.commons.configuration.io.yaml.YamlConfigurationReader.<init>(YamlConfigurationReader.java:48)
      	at org.infinispan.commons.configuration.io.ConfigurationReader$Builder.build(ConfigurationReader.java:96)
      	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:174)
      	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:157)
      	... 8 more
      

      Operator logs

      2022-10-11T13:31:47.539Z	ERROR	Error encountered for event 'update-cache': unable to Update Cache CR 'testcache-dpt6q': unable to convert cache configuration from 'application/yaml' to 'application/xml': unexpected HTTP status code (100): unexpected error creating cache with template, response: 100 Continue
      github.com/infinispan/infinispan-operator/launcher/listener.New.func3.1
      	/root/go/src/github.com/infinispan/infinispan-operator/launcher/listener/listener.go:140
      github.com/r3labs/sse/v2.(*Client).SubscribeWithContext.func1
      	/root/go/src/github.com/infinispan/infinispan-operator/vendor/github.com/r3labs/sse/v2/client.go:91
      gopkg.in/cenkalti/backoff%2ev1.RetryNotify
      	/root/go/src/github.com/infinispan/infinispan-operator/vendor/gopkg.in/cenkalti/backoff.v1/retry.go:37
      github.com/r3labs/sse/v2.(*Client).SubscribeWithContext
      	/root/go/src/github.com/infinispan/infinispan-operator/vendor/github.com/r3labs/sse/v2/client.go:99
      github.com/r3labs/sse/v2.(*Client).SubscribeRawWithContext
      	/root/go/src/github.com/infinispan/infinispan-operator/vendor/github.com/r3labs/sse/v2/client.go:231
      github.com/infinispan/infinispan-operator/launcher/listener.New.func3
      	/root/go/src/github.com/infinispan/infinispan-operator/launcher/listener/listener.go:129
      

      https://yaml.org/spec/1.2.2/#65-line-folding
      https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines

              ttarrant@redhat.com Tristan Tarrant
              remerson@redhat.com Ryan Emerson
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: