GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Try to fix/stabilize a number of flaky tests (#16934) (#17763) · netty/netty@ac4ea46

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • buffer/src/test/java/io/netty/buffer
    • AbstractByteBufTest.java
    • PooledByteBufAllocatorTest.java
  • common/src/main/java/io/netty/util/internal
    • ThrowableUtil.java
  • transport/src/test/java/io/netty/channel/nio
    • NioEventLoopTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/AbstractByteBufTest.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,9 +2816,9 @@ public void run() {
28162816
while (latch.getCount() > 0) {
28172817
ByteBuf buf;
28182818
if (slice) {
2819-
buf = buffer.slice();
2819+
buf = buffer.slice();
28202820
} else {
2821-
buf = buffer.duplicate();
2821+
buf = buffer.duplicate();
28222822
}
28232823
TestGatheringByteChannel channel = new TestGatheringByteChannel();
28242824

@@ -2847,7 +2847,7 @@ public void run() {
28472847
}
28482848
try {
28492849
latch.await();
2850-
barrier.await(5, TimeUnit.SECONDS);
2850+
barrier.await(30, TimeUnit.SECONDS);
28512851
} catch (Exception e) {
28522852
Throwable inner = innerThrowable.get();
28532853
if (inner != null) {
@@ -2931,7 +2931,7 @@ public void run() {
29312931
}
29322932
try {
29332933
latch.await();
2934-
barrier.await(5, TimeUnit.SECONDS);
2934+
barrier.await(30, TimeUnit.SECONDS);
29352935
} catch (Exception e) {
29362936
Throwable inner = innerThrowable.get();
29372937
if (inner != null) {
Collapse file

‎buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java‎

Copy file name to clipboardExpand all lines: buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.List;
3131
import java.util.Queue;
3232
import java.util.Random;
33+
import java.util.concurrent.CompletionException;
3334
import java.util.concurrent.ConcurrentLinkedQueue;
3435
import java.util.concurrent.CountDownLatch;
3536
import java.util.concurrent.FutureTask;
@@ -431,7 +432,7 @@ public void run() {
431432
}
432433

433434
@Test
434-
@Timeout(10)
435+
@Timeout(30)
435436
public void testNumThreadCachesWithNoDirectArenas() throws Exception {
436437
int numHeapArenas = 1;
437438
final PooledByteBufAllocator allocator =
@@ -451,7 +452,7 @@ public void testNumThreadCachesWithNoDirectArenas() throws Exception {
451452
}
452453

453454
@Test
454-
@Timeout(10)
455+
@Timeout(30)
455456
public void testNumThreadCachesAccountForDirectAndHeapArenas() throws Exception {
456457
int numArenas = 1;
457458
final PooledByteBufAllocator allocator =
@@ -471,7 +472,7 @@ public void testNumThreadCachesAccountForDirectAndHeapArenas() throws Exception
471472
}
472473

473474
@Test
474-
@Timeout(10)
475+
@Timeout(30)
475476
public void testThreadCacheToArenaMappings() throws Exception {
476477
int numArenas = 2;
477478
final PooledByteBufAllocator allocator =
@@ -561,6 +562,13 @@ public void destroy() throws Exception {
561562
task.get();
562563
t.join();
563564
} catch (InterruptedException e) {
565+
if (task.isDone()) {
566+
try {
567+
task.get();
568+
} catch (Exception taskException) {
569+
e.addSuppressed(new CompletionException("Task failed", taskException));
570+
}
571+
}
564572
ThrowableUtil.interruptAndAttachAsyncStackTrace(t, e);
565573
throw e;
566574
}
Collapse file

‎common/src/main/java/io/netty/util/internal/ThrowableUtil.java‎

Copy file name to clipboardExpand all lines: common/src/main/java/io/netty/util/internal/ThrowableUtil.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ public static Throwable[] getSuppressed(Throwable source) {
9292
* @param cause The cause to attach a stack trace to.
9393
*/
9494
public static void interruptAndAttachAsyncStackTrace(Thread thread, Throwable cause) {
95+
Thread.State state = thread.getState();
9596
StackTraceElement[] stackTrace = thread.getStackTrace();
9697
InterruptedException asyncIE = new InterruptedException(
97-
"Asynchronous interruption: " + thread);
98+
"Asynchronous interruption: " + thread + " (" + state + ')');
9899
thread.interrupt();
99100
asyncIE.setStackTrace(stackTrace);
100101
addSuppressed(cause, asyncIE);
Collapse file

‎transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java‎

Copy file name to clipboardExpand all lines: transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,15 @@ public void channelUnregistered(SocketChannel ch, Throwable cause) {
201201
@Test
202202
public void testTaskRemovalOnShutdownThrowsNoUnsupportedOperationException() throws Exception {
203203
final AtomicReference<Throwable> error = new AtomicReference<Throwable>();
204+
final AtomicBoolean loopStarted = new AtomicBoolean();
204205
final Runnable task = new Runnable() {
205206
@Override
206207
public void run() {
207208
// NOOP
208209
}
209210
};
210211
// Just run often enough to trigger it normally.
211-
for (int i = 0; i < 1000; i++) {
212+
for (int i = 0; i < 250; i++) {
212213
NioEventLoopGroup group = new NioEventLoopGroup(1);
213214
final NioEventLoop loop = (NioEventLoop) group.next();
214215

@@ -218,18 +219,23 @@ public void run() {
218219
try {
219220
for (;;) {
220221
loop.execute(task);
222+
loopStarted.set(true);
221223
}
222224
} catch (Throwable cause) {
223225
error.set(cause);
224226
}
225227
}
226228
});
227229
t.start();
230+
do {
231+
Thread.yield();
232+
} while (!loopStarted.get());
228233
group.shutdownNow();
229234
t.join();
230235
group.terminationFuture().syncUninterruptibly();
231236
assertInstanceOf(RejectedExecutionException.class, error.get());
232237
error.set(null);
238+
loopStarted.set(false);
233239
}
234240
}
235241

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.