Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32296

Improve perf of Sensitive Filter (Redactor)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.7, 2021.49
    • Component/s: Performance
    • Release Notes Summary:
      Sensitive filter performance have been improved.
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #105
    • Story Points:
      3

      Description

      We have seen that the org.nuxeo.log4j.Redactor used by the org.nuxeo.log4j.MaskSensitiveDataRewritePolicy is inefficient with long value like a classpath. This can be a serious problem because this filter is also used to dump log4j2 logs in production.

      In unit test there are two of such properties:

      • java.class.path
      • surefire.test.class.path

      Each one is around 45k characters which brings unit tests to time out during http calls (around 72 seconds for org.nuxeo.ecm.restapi.server.jaxrs.management.TestConfigurationObject#testGet in the CI while the timeout is "only" 60 seconds) because we process those values before a dump.

      We need to investigate which regex is behind this and improve it.

      jstack sample:

      "http-nio-43863-exec-1" #114 daemon prio=5 os_prio=0 cpu=50321,10ms elapsed=117,41s tid=0x00007fa6e308b3f0 nid=0x2216 runnable  [0x00007fa5db0f4000]
         java.lang.Thread.State: RUNNABLE
      	at java.util.regex.Pattern$CharPropertyGreedy.match(java.base@17.0.5/Pattern.java:4272)
      	at java.util.regex.Pattern$GroupHead.match(java.base@17.0.5/Pattern.java:4789)
      	at java.util.regex.Pattern$StartS.match(java.base@17.0.5/Pattern.java:3641)
      	at java.util.regex.Matcher.search(java.base@17.0.5/Matcher.java:1728)
      	at java.util.regex.Matcher.find(java.base@17.0.5/Matcher.java:745)
      	at org.nuxeo.log4j.Redactor.maskSensitive(Redactor.java:61)
      	at org.nuxeo.ecm.restapi.jaxrs.io.management.ConfigurationPropertiesJsonWriter.getMaskedSensitiveValue(ConfigurationPropertiesJsonWriter.java:99)
      	at org.nuxeo.ecm.restapi.jaxrs.io.management.ConfigurationPropertiesJsonWriter.writeStringProperty(ConfigurationPropertiesJsonWriter.java:83)
      	at org.nuxeo.ecm.restapi.jaxrs.io.management.ConfigurationPropertiesJsonWriter.writeProperty(ConfigurationPropertiesJsonWriter.java:71)
      	at org.nuxeo.ecm.restapi.jaxrs.io.management.ConfigurationPropertiesJsonWriter.lambda$0(ConfigurationPropertiesJsonWriter.java:64)
      	at org.nuxeo.ecm.restapi.jaxrs.io.management.ConfigurationPropertiesJsonWriter$$Lambda$832/0x0000000801816568.accept(Unknown Source)
      	at org.nuxeo.common.function.ThrowableBiConsumer.lambda$asBiConsumer$0(ThrowableBiConsumer.java:50)
      	at org.nuxeo.common.function.ThrowableBiConsumer$$Lambda$833/0x00000008018167a8.accept(Unknown Source)
      	at java.util.concurrent.ConcurrentHashMap.forEach(java.base@17.0.5/ConcurrentHashMap.java:1603)
      	at java.util.Properties.forEach(java.base@17.0.5/Properties.java:1422)
      

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: