Jason O'Sullivan created HDDS-14778:
---------------------------------------

             Summary: ozone-filesystem-hadoop3 shading corrupts protobuf 
descriptor binary causing InvalidProtocolBufferException with TRACE logging
                 Key: HDDS-14778
                 URL: https://issues.apache.org/jira/browse/HDDS-14778
             Project: Apache Ozone
          Issue Type: Bug
    Affects Versions: 1.4.0
            Reporter: Jason O'Sullivan
             Fix For: 2.2.0


h3. Problem

When TRACE logging is enabled, any Ozone client operation via ofs:// fails with:

{code}
java.lang.ExceptionInInitializerError
    at 
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.<clinit>
Caused by: com.google.protobuf.InvalidProtocolBufferException: 
    Protocol message tag had invalid wire type
    at 
com.google.protobuf.Descriptors$FileDescriptor.internalBuildGeneratedFileFrom
{code}

h3. Root Cause
The io relocation rule in ozonefs-shaded/pom.xml has no <includes> guard, so 
the shade plugin's startsWith("io") check matches binary protobuf descriptor 
chunks that happen to start with the bytes "io".

{code}
<relocation>
  <pattern>io</pattern>
  <shadedPattern>${ozone.shaded.prefix}.io</shadedPattern>
  <excludes>
    <exclude>io!netty!*</exclude>
  </excludes>
</relocation>
{code}

This corrupts the descriptor data stored as string constants in 
OzoneManagerProtocolProtos.class. When TRACE logging triggers the first access 
to that class, protobuf fails to parse the corrupted descriptor.

This is a latent bug — it fires whenever a proto change shifts a descriptor 
chunk boundary onto bytes starting with "io". The same issue exists for the 
info, kotlin, picocli, okio, and okhttp3 rules.

h3. Potential Fix
Add <includes> to the io rule, consistent with how the org and com rules are 
already configured:
{code}
<relocation>
  <pattern>io</pattern>
  <shadedPattern>${ozone.shaded.prefix}.io</shadedPattern>
  <includes>
    <include>io.grpc.**.*</include>
    <include>io.opentelemetry.**.*</include>
  </includes>
  <excludes>
    <exclude>io!netty!*</exclude>
  </excludes>
</relocation>
{code}



--
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