[ 
https://issues.apache.org/jira/browse/SOLR-11456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man updated SOLR-11456:
----------------------------
    Attachment: SOLR-11456.patch

here's a patch with an attempted fix using {{expectThrows}} but on my machine 
it fails -- no RemoteSolrException is thrown.

best guess: the reconnect logic seems to be happening very quickly, so maybe 
the node thinks it's healthy again by the time the healthcheck call is made?

{noformat}
   [junit4]   2> 1780 INFO  
(TEST-HealthCheckHandlerTest.testHealthCheckHandler-seed#[D95E86B813E36BF4]) [  
  ] o.a.s.SolrTestCaseJ4 ###Starting testHealthCheckHandler
   [junit4]   2> 2020 INFO  (qtp1914125569-26) [n:127.0.0.1:52504_solr    ] 
o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/health 
params={wt=javabin&version=2} status=0 QTime=22
   [junit4]   2> 2055 INFO  
(TEST-HealthCheckHandlerTest.testHealthCheckHandler-seed#[D95E86B813E36BF4]) [  
  ] o.a.s.c.MiniSolrCloudCluster Expired zookeeper session 98802019973332995 
from node http://127.0.0.1:52504/solr
   [junit4]   2> 2056 WARN  
(jetty-launcher-1-thread-1-SendThread(127.0.0.1:53478)) [n:127.0.0.1:52504_solr 
   ] o.a.z.ClientCnxn Session 0x15f03e9e79a0003 for server 
127.0.0.1/127.0.0.1:53478, unexpected error, closing socket connection and 
attempting reconnect
   [junit4]   2> java.nio.channels.ClosedChannelException
   [junit4]   2>        at 
sun.nio.ch.SocketChannelImpl.ensureReadOpen(SocketChannelImpl.java:257)
   [junit4]   2>        at 
sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:300)
   [junit4]   2>        at 
org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:68)
   [junit4]   2>        at 
org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
   [junit4]   2>        at 
org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
   [junit4]   2> 2057 INFO  (zkCallback-13-thread-1) [    ] 
o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (1) -> (0)
   [junit4]   2> 2159 INFO  (qtp1914125569-28) [n:127.0.0.1:52504_solr    ] 
o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/health 
params={wt=javabin&version=2} status=0 QTime=0
   [junit4]   2> 2160 WARN  
(zkCallback-8-thread-1-processing-n:127.0.0.1:52504_solr) 
[n:127.0.0.1:52504_solr    ] o.a.s.c.c.ConnectionManager Watcher 
org.apache.solr.common.cloud.ConnectionManager@614458f5 name: 
ZooKeeperConnection Watcher:127.0.0.1:53478/solr got event WatchedEvent 
state:Disconnected type:None path:null path: null type: None
   [junit4]   2> 2160 WARN  
(zkCallback-8-thread-1-processing-n:127.0.0.1:52504_solr) 
[n:127.0.0.1:52504_solr    ] o.a.s.c.c.ConnectionManager zkClient has 
disconnected
   [junit4]   2> 2162 INFO  
(TEST-HealthCheckHandlerTest.testHealthCheckHandler-seed#[D95E86B813E36BF4]) [  
  ] o.a.s.SolrTestCaseJ4 ###Ending testHealthCheckHandler
   [junit4]   2> NOTE: reproduce with: ant test  
-Dtestcase=HealthCheckHandlerTest -Dtests.method=testHealthCheckHandler 
-Dtests.seed=D95E86B813E36BF4 -Dtests.multiplier=2 -Dtests.slow=true 
-Dtests.locale=es-EC -Dtests.timezone=AGT -Dtests.asserts=true 
-Dtests.file.encoding=UTF-8q
   [junit4] FAILURE 0.41s | HealthCheckHandlerTest.testHealthCheckHandler <<<
   [junit4]    > Throwable #1: junit.framework.AssertionFailedError: Expected 
exception RemoteSolrException but no exception was thrown
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([D95E86B813E36BF4:F84CC1A626ECEF60]:0)
   [junit4]    >        at 
org.apache.lucene.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2672)
   [junit4]    >        at 
org.apache.solr.cloud.HealthCheckHandlerTest.testHealthCheckHandler(HealthCheckHandlerTest.java:69)
   [junit4]    >        at java.lang.Thread.run(Thread.java:748)
{noformat}

> HealthCheckHandlerTest.testHealthCheckHandler() asserts nothing useful
> ----------------------------------------------------------------------
>
>                 Key: SOLR-11456
>                 URL: https://issues.apache.org/jira/browse/SOLR-11456
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>         Attachments: SOLR-11456.patch
>
>
> The meat of {{HealthCheckHandlerTest.testHealthCheckHandler()}} currently 
> looks like this...
> {code}
>       while (live_nodes.size() == 1 && counter++ < 100) {
>         Thread.sleep(100);
>         live_nodes = 
> cluster.getSolrClient().getZkStateReader().getClusterState().getLiveNodes();
>       }
>       try {
>         req.process(httpSolrClient);
>       } catch (HttpSolrClient.RemoteSolrException e) {
>         assertTrue(e.getMessage(), e.getMessage().contains("Host 
> Unavailable"));
>         assertEquals(SolrException.ErrorCode.SERVICE_UNAVAILABLE.code, 
> e.code());
>       }
> {code}
> * nothing actually asserts that {{live_nodes.size() != 1}} -- so the loop 
> could just exit after 100 iterations w/o any changes to hte system happening.
> * instead of using expectThrows, the only assertions are inside the catch 
> block -- if the code (unexpectedly) succeeds the test will not fail (false 
> positive)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to