wuya created HDDS-15963:
---------------------------

             Summary: Fix EC degraded read NPE caused by CodecRegistry 
depending on TCCL in isolated ClassLoader
                 Key: HDDS-15963
                 URL: https://issues.apache.org/jira/browse/HDDS-15963
             Project: Apache Ozone
          Issue Type: Bug
          Components: Ozone Client
    Affects Versions: 2.2.0, 2.1.0
            Reporter: wuya
            Assignee: wuya


When EC degraded read is triggered in an environment with an isolated plugin
class loader (e.g. Trino Hive connector), CodecRegistry fails to discover
RawErasureCoderFactory providers, causing a NullPointerException.

CodecRegistry uses ServiceLoader.load(RawErasureCoderFactory.class) which
relies on the thread context class loader (TCCL). In Trino's plugin isolation
model, the TCCL cannot see the Ozone jar's META-INF/services providers.

As a result, CodecRegistry.getCoderNames("rs") returns null, leading to:

  java.lang.NullPointerException:
  Cannot read the array length because "<local3>" is null
      at org.apache.ozone.erasurecode.rawcoder.util.CodecUtil
          .createRawDecoderWithFallback(CodecUtil.java:90)

The fix is to pass CodecRegistry's own class loader explicitly:

  ServiceLoader.load(RawErasureCoderFactory.class,
      CodecRegistry.class.getClassLoader());

This ensures provider discovery works regardless of the TCCL, matching the
behavior seen when not using plugin class loaders (e.g. Spark works fine).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to