Open code4china opened 1 month ago
Java SDK (apache/dubbo)
Dubbo Java 3.2.12
jStack_ConcurrencyDump_Active_10MinSilence
@Test void jStack_ConcurrencyDump_Active_10MinSilence() { URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?dump.directory=/tmp&version=1.0.0&application=morgan&noValue="); AtomicInteger jStackCount = new AtomicInteger(0); AtomicInteger finishedCount = new AtomicInteger(0); AbortPolicyWithReport abortPolicyWithReport = new AbortPolicyWithReport("Test", url) { @Override protected void jstack(FileOutputStream jStackStream) { jStackCount.incrementAndGet(); try { Thread.sleep(3000); } catch (Exception e) { } } }; ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( 4, 4, 0, TimeUnit.MILLISECONDS, new SynchronousQueue<>(), new NamedInternalThreadFactory("jStackRepeatFixedTest", false), abortPolicyWithReport); List<Future<?>> futureList = new LinkedList<>(); for (int pos = 0; pos < 100; pos++) { try { futureList.add(threadPoolExecutor.submit(() -> { finishedCount.incrementAndGet(); })); } catch (Exception ignored) { } } futureList.stream().forEach(f -> { try { f.get(1000, TimeUnit.MILLISECONDS); } catch (Exception ignored) { } }); System.out.printf("finishedCount: %d, jStackCount: %d\n", finishedCount.get(), jStackCount.get()); Assertions.assertEquals(jStackCount.get(), 1); }
jStackCount must equal 1, because AbortPolicyWithReport will silence TEN_MINUTES_MILLS to avoid jstack's count
jStackCount
1
AbortPolicyWithReport
TEN_MINUTES_MILLS
This issue may cause JVM hang for a short time, it should be fixed as soon as possible!
Can you help us fix this by submitting a pr?
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
Dubbo Java 3.2.12
Steps to reproduce this issue
jStack_ConcurrencyDump_Active_10MinSilence
, error will occurred immediatelyWhat you expected to happen
jStackCount
must equal1
, becauseAbortPolicyWithReport
will silenceTEN_MINUTES_MILLS
to avoid jstack's countAnything else
This issue may cause JVM hang for a short time, it should be fixed as soon as possible!
Are you willing to submit a pull request to fix on your own?
Code of Conduct