Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f43dbea
feat(dedup): v3 honest TCP protocol, async executor tails, and listen…
slayerjain Nov 26, 2026
3b9e07d
fix(dedup): address r1 review — app-only rewrites, dynamic HELLO, opt…
slayerjain Nov 26, 2026
65da5b7
fix(dedup): address r2 review — non-latching JaCoCo lookup, live HELL…
slayerjain Nov 26, 2026
a8c6177
fix(dedup): address r3 review — bounded O(1) self-removing tracking, …
slayerjain Nov 26, 2026
b7a53fa
fix(dedup): address r4 review — weak HandRef tokens with ReferenceQue…
slayerjain Nov 26, 2026
0271fed
fix(dedup): address plg-87 audit — v3 identity HELLO, fail-closed poo…
slayerjain Nov 26, 2026
2e43c97
fix(dedup): close untracked async tail, B2 async forms, unarmed in-fl…
slayerjain Nov 27, 2026
95b625e
fix(dedup): guard MinimalStage isDone, track MinimalFuture & GC permi…
slayerjain Nov 27, 2026
db2174c
fix(dedup): track executing work past lingering cap, live Thread/Sche…
slayerjain Nov 27, 2026
a6cc514
fix(dedup): close R5 review gaps — late-start current-window contamin…
slayerjain Nov 27, 2026
e24bf0a
test(dedup): consume one-time untracked tail report before asserting …
slayerjain Nov 27, 2026
5650f4f
test(dedup): fix supplier countdown race before RequestGate.exit and …
slayerjain Nov 27, 2026
b582be1
fix(dedup): address R1 review — unverified no-server-entry, Executor …
slayerjain Nov 27, 2026
cf6e0c9
fix(dedup): close R9 review findings — TimerTask running-body & cance…
slayerjain Nov 27, 2026
53304de
fix(dedup): suppress BACKGROUND after no-server-entry, add Timer.canc…
slayerjain Nov 27, 2026
6576c18
test(dedup): add TCP no-server-entry BACKGROUND suppression test and …
slayerjain Nov 27, 2026
88567de
fix(dedup): runtime-check executor method refs, latch windowCut=false…
slayerjain Nov 27, 2026
56f289a
fix(dedup): latch asyncExecutors=false on pre-captured executor metho…
slayerjain Nov 27, 2026
e8eba30
test(smoke): accept protocol v3 ACK caps and trailing unverified fiel…
slayerjain Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion keploy-sdk/src/main/java/io/keploy/dedup/BuildTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static <T> List<ClassFile> files(List<T> entries, Function<T, String> name, Func

/**
* answer is the control socket's reply to Keploy's TABLE command. When the heap has less free than the
* table needs ({@link #lowHeap}) the analysis is skipped and the reply is {@code IGNORED proto=2
* table needs ({@link #lowHeap}) the analysis is skipped and the reply is {@code IGNORED proto=3
* reason=low_heap heap_free_mb=F heap_needed_mb=N}, with a WARNING in the app's log; else it is
* {@link #request}'s ACK or IGNORED. The heap is read once, here, when Keploy asks: a send that runs after
* another one was checked when it was asked. The bound takes loaded, the class count of the index when it
Expand Down
660 changes: 578 additions & 82 deletions keploy-sdk/src/main/java/io/keploy/dedup/JobGate.java

Large diffs are not rendered by default.

944 changes: 859 additions & 85 deletions keploy-sdk/src/main/java/io/keploy/dedup/KeployDedupAgent.java

Large diffs are not rendered by default.

534 changes: 484 additions & 50 deletions keploy-sdk/src/main/java/io/keploy/dedup/OrderedPools.java

Large diffs are not rendered by default.

5,051 changes: 4,943 additions & 108 deletions keploy-sdk/src/main/java/io/keploy/dedup/RequestGate.java

Large diffs are not rendered by default.

1,374 changes: 1,267 additions & 107 deletions keploy-sdk/src/main/java/io/keploy/dedup/ServerEntries.java

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions keploy-sdk/src/test/java/io/keploy/dedup/AppIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,15 @@ public void aJvmWithNoReceiverNeverReadsItsIndexForTheReport() throws Exception
assertTrue(KeployDedupAgent.start());
// Answered after the send at the bind: the worker runs it before its
// first accept.
assertEquals("IGNORED proto=2\n", send("END test-set-0/test-0"));
assertEquals("IGNORED proto=3\n", send("END test-set-0/test-0"));
assertNotLogged("fingerprint");
}

private void startAndSendStart() throws IOException {
assertTrue(KeployDedupAgent.start());
assertEquals("ACK proto=2\n", send("START test-set-0/test-1"));
String reply = send("START test-set-0/test-1");
assertTrue("expected ACK proto=3 caps=..., got: " + reply,
reply.startsWith("ACK proto=3 caps=") && reply.endsWith("\n"));
}

// assertIndex checks the INDEX report of the index the agent started on.
Expand Down
14 changes: 9 additions & 5 deletions keploy-sdk/src/test/java/io/keploy/dedup/AsyncHandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ public void close() {
logger.addHandler(handler);
try {
assertFalse("no executor", OrderedPools.orders(null));
assertFalse("no pool", OrderedPools.orders(new Object()));
for (BlockingQueue<Runnable> queue : Arrays.<BlockingQueue<Runnable>>asList(new LinkedBlockingQueue<>(),
new SynchronousQueue<>(), new ArrayBlockingQueue<>(1), new LinkedBlockingDeque<>(),
new LinkedTransferQueue<>())) {
Expand All @@ -513,6 +512,9 @@ public void close() {
}
assertEquals(logged.toString(), 0, logged.size());

assertTrue("unknown object fails closed", OrderedPools.orders(new Object()));
logged.clear();

assertTrue(OrderedPools.orders(new Priority(pool(new PriorityBlockingQueue<>()))));
assertTrue("said once", OrderedPools.orders(new Priority(pool(new PriorityBlockingQueue<>()))));
assertEquals(Collections.singletonList("INFO Keploy dedup does not count the tasks handed to "
Expand Down Expand Up @@ -773,16 +775,18 @@ protected Class<?> findClass(String binary) throws ClassNotFoundException {
return executor;
}

// An executor whose class has a public getThreadPoolExecutor() and a
// public method that names a type no class loader has.
// An executor whose class (extending Spring's SimpleAsyncTaskExecutor) has
// a public getThreadPoolExecutor() and a public method that names a type no
// class loader has.
private static Object missingTypeExecutor() throws Exception {
String name = "org/example/pools/MissingType";
String parent = "org/springframework/core/task/SimpleAsyncTaskExecutor";
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
writer.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, name, null, "java/lang/Object", null);
writer.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, name, null, parent, null);
MethodVisitor init = writer.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
init.visitCode();
init.visitVarInsn(Opcodes.ALOAD, 0);
init.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
init.visitMethodInsn(Opcodes.INVOKESPECIAL, parent, "<init>", "()V", false);
init.visitInsn(Opcodes.RETURN);
init.visitMaxs(0, 0);
init.visitEnd();
Expand Down
23 changes: 15 additions & 8 deletions keploy-sdk/src/test/java/io/keploy/dedup/ControlSocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
* The unix control socket Keploy sends START and END on. Keploy fires its first
* test as soon as the app answers its health check, so the socket must listen
* by the time start() (premain, before the app's main) returns. Every command
* the SDK reads gets one answer line before the close: "ACK proto=2" if it was
* taken, "IGNORED proto=2" if not. Keploy reads a close with no answer from an
* SDK that says proto=2 as a command not taken, so only a connection closed
* with nothing sent may go unanswered.
* the SDK reads gets one answer line before the close:
* "ACK proto=3 caps=windowCut=...,contaminated=...,classMismatch=...,background=...,ackId=true,asyncExecutors=...,listenerContamination=..."
* if it was taken, "IGNORED proto=3" if not. Keploy reads a close with no
* answer from an SDK that says proto&gt;=2 as a command not taken, so only a
* connection closed with nothing sent may go unanswered.
*
* <p>The answers are compared with literals, not the SDK's constants: Keploy
* reads the words, so a change to them must fail here.
Expand All @@ -65,8 +66,10 @@ public class ControlSocketTest {
private static final String WARMUP_DISABLED_PROPERTY = "keploy.java.dedup.warmup.disabled";
private static final String CLASS_DIRS_PROPERTY = "keploy.java.class.dirs";
private static final String END_WAIT_PROPERTY = "keploy.java.end.wait.ms";
private static final String TAKEN = "ACK proto=2\n";
private static final String IGNORED = "IGNORED proto=2\n";
private static final String TAKEN =
"ACK proto=3 caps=windowCut=false,contaminated=false,classMismatch=true,"
+ "background=false,ackId=true,asyncExecutors=false,listenerContamination=false\n";
private static final String IGNORED = "IGNORED proto=3\n";

private String savedControlPath;
private String savedDataPath;
Expand Down Expand Up @@ -114,6 +117,8 @@ public void setUp() throws IOException {
// unless a row sets its own bound.
System.setProperty(BuildTable.MIN_HEAP_PROPERTY, "0");
KeployDedupAgent.transformerAdded = false;
KeployDedupAgent.executorCallSitesEnabled = false;
ServerEntries.setHookStatusForTests(false, false, false);
}

/** A TABLE row needs the heap check's env var unset: it would win over the property setUp sets. */
Expand All @@ -139,6 +144,8 @@ public void tearDown() throws Exception {
System.clearProperty(BuildTable.MIN_HEAP_PROPERTY);
System.clearProperty(END_WAIT_PROPERTY);
KeployDedupAgent.transformerAdded = false;
KeployDedupAgent.executorCallSitesEnabled = false;
ServerEntries.setHookStatusForTests(false, false, false);
if (jacoco != null) {
jacoco.close();
}
Expand Down Expand Up @@ -208,8 +215,8 @@ public void aTestStartedAndEndedIsAnsweredTakenAndItsCoverageIsSent() throws Exc

@Test
public void aJobRunningInATestsWindowIsNamedInItsRecordAndOneBetweenTestsIsNot() throws Exception {
startWithJacoco();
data = new DataReceiver(KeployDedupAgent.dataSocketPath);
startWithJacoco();
// Running when the START opens the window, done before its END.
Object running = JobGate.enter(new Object(), "quartz");
try {
Expand Down Expand Up @@ -394,7 +401,7 @@ public void aTableAskedWhenTheHeapIsShortIsDeclinedWithLowHeapAndSendsNothing()
int asked = BuildTable.requests();
assertEquals(TAKEN, send("START test-set-0/test-1"));
String reply = send("TABLE");
assertTrue(reply, reply.matches("IGNORED proto=2 reason=low_heap heap_free_mb=\\d+ heap_needed_mb="
assertTrue(reply, reply.matches("IGNORED proto=3 reason=low_heap heap_free_mb=\\d+ heap_needed_mb="
+ needed + "\n"));
assertEquals("no send started", asked, BuildTable.requests());
assertNull("no table frame", data.payloads.poll(2, TimeUnit.SECONDS));
Expand Down
Loading
Loading