iamsanjay commented on PR #2235:
URL: https://github.com/apache/solr/pull/2235#issuecomment-1923725189

   Not related to this change!
   > java.lang.AssertionError: expected 
same:<org.apache.solr.request.SolrRequestInfo@922a9b2> was not:<null>
   >    >         at __randomizedtesting.SeedInfo.seed([BF8CAE2E1F3CCF8F]:0)
   >    >         at org.junit.Assert.fail(Assert.java:89)
   >    >         at org.junit.Assert.failNotSame(Assert.java:829)
   >    >         at org.junit.Assert.assertSame(Assert.java:772)
   >    >         at org.junit.Assert.assertSame(Assert.java:783)
   >    >         at 
org.apache.solr.request.TestSolrRequestInfo.lambda$testThreadPool$0(TestSolrRequestInfo.java:64)
   >    >         at 
org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:294)
   >    >         at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   >    >         at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   
   ```
   public void testThreadPool() throws InterruptedException {
       final SolrRequestInfo info =
           new SolrRequestInfo(
               new LocalSolrQueryRequest(h.getCore(), params()), new 
SolrQueryResponse());
       AtomicInteger counter = new AtomicInteger();
   
       SolrRequestInfo.setRequestInfo(info);
       ExecutorUtil.MDCAwareThreadPoolExecutor pool =
           new ExecutorUtil.MDCAwareThreadPoolExecutor(
               1, 1, 1, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1));
       AtomicBoolean run = new AtomicBoolean(false);
       pool.execute(
           () -> {
             final SolrRequestInfo poolInfo = SolrRequestInfo.getRequestInfo();
             assertSame(info, poolInfo);
             info.addCloseHook(counter::incrementAndGet);
             run.set(true);
           });
       if (random().nextBoolean()) {
         pool.shutdown();
       } else {
         pool.shutdownNow();
       }
       SolrRequestInfo.clearRequestInfo();
       SolrRequestInfo.reset();
   
       pool.awaitTermination(1, TimeUnit.MINUTES);
       assertTrue(run.get());
       assertEquals("hook should be closed only once", 1, counter.get());
       assertNull(SolrRequestInfo.getRequestInfo());
     }
   ```
   
   Above test failed during the build run, failed at 
   ```
   assertSame(info, poolInfo);
   ```
   I believe before the Runnable got executed, other line 
`SolrRequestInfo.clearRequestInfo();` which would pop SolrRequestInfo from the 
stack and When finally the Runnable started, it failed at  `assertSame(info, 
poolInfo)`. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to