Andrew Kyle Purtell created PHOENIX-8095:
--------------------------------------------

             Summary: MetadataServerConnectionsIT reads empty slots of the 
thread array
                 Key: PHOENIX-8095
                 URL: https://issues.apache.org/jira/browse/PHOENIX-8095
             Project: Phoenix
          Issue Type: Test
          Components: test
    Affects Versions: 5.3.2
            Reporter: Andrew Kyle Purtell
            Assignee: Andrew Kyle Purtell
             Fix For: 5.4.0, 5.3.3


{{MetadataServerConnectionsIT.testViewCreationAndServerConnections}} fails 
sometimes:


{noformat}
[ERROR] 
org.apache.phoenix.end2end.MetadataServerConnectionsIT.testViewCreationAndServerConnections
 -- Time elapsed: 12.26 s <<< ERROR!
org.apache.phoenix.exception.PhoenixIOException: 
org.apache.hadoop.hbase.DoNotRetryIOException: Not allowed
        at 
org.apache.phoenix.end2end.MetadataServerConnectionsIT$TestMetaDataEndpointImpl.createTable(MetadataServerConnectionsIT.java:183)
...
        at 
org.apache.phoenix.end2end.MetadataServerConnectionsIT.testViewCreationAndServerConnections(MetadataServerConnectionsIT.java:249)
...
Caused by: org.apache.hadoop.hbase.DoNotRetryIOException: 
org.apache.hadoop.hbase.DoNotRetryIOException: Not allowed {noformat}
The test installs a coprocessor, {{{}TestMetaDataEndpointImpl{}}}. Its 
{{createTable}} counts the threads with the name {{{}htable-pool-0{}}}:

{{{{int count = Thread.activeCount();
Thread[] th = new Thread[count];
// returns the number of threads put into the array
Thread.enumerate(th);
long hTablePoolCount =
  Arrays.stream(th).filter(s -> 
s.getName().equals("htable-pool-0")).count();}}}}

{{Thread.activeCount()}} gives only an estimate. If threads stop between the 
two calls, {{Thread.enumerate}} fills fewer slots than the array has. The code 
ignores the return value, so the stream also reads the empty slots. 
{{s.getName()}} on a null slot throws {{{}NullPointerException{}}}.

The coprocessor catches {{{}RuntimeException{}}}. It logs "This is unexpected" 
without the exception. Then it returns {{{}DoNotRetryIOException("Not 
allowed"){}}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to