Skip to content

feat: replace OCI hook networking with inline CNI calls - #443

Draft
ayush-panta wants to merge 18 commits into
mainfrom
feat/hookless-networking
Draft

feat: replace OCI hook networking with inline CNI calls#443
ayush-panta wants to merge 18 commits into
mainfrom
feat/hookless-networking

Conversation

@ayush-panta

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

Testing done:

  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ayush-panta ayush-panta changed the title feat: replace OCI hook networking with inline CNI calls feat: replace OCI hook networking with inline CNI calls Apr 23, 2026
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch 8 times, most recently from 3bc32d1 to 9467e26 Compare April 30, 2026 21:42
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch from 9467e26 to 7c6a040 Compare May 19, 2026 18:40
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch from 7c6a040 to db603ca Compare June 1, 2026 15:24
@ayush-panta
ayush-panta marked this pull request as ready for review June 22, 2026 22:46
@ayush-panta
ayush-panta requested a review from a team as a code owner June 22, 2026 22:46
@ayush-panta
ayush-panta marked this pull request as draft June 22, 2026 22:46
@ayush-panta ayush-panta reopened this Jun 22, 2026
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch 7 times, most recently from c608572 to 7187eae Compare June 23, 2026 23:22
@ayush-panta ayush-panta reopened this Jun 23, 2026
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch 4 times, most recently from 6705a20 to 088534e Compare June 24, 2026 06:44
@ayush-panta ayush-panta reopened this Jun 24, 2026
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch from c01afaa to e3b582f Compare June 29, 2026 17:16
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Signed-off-by: ayush-panta <ayushkp@amazon.com>
Add --log-cli-level=DEBUG to pytest invocations for invoke and
start-lambda tests to capture SAM CLI internal timing during test
failures.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
When a container is force-removed while an attach stream is following
logs, the task exit channel (waitCh) may never fire because the task is
already deleted. This causes the attach connection to hang until the
client times out.

Subscribe to containerd's container delete event as a fallback signal
to stop the log viewer immediately when the container is removed.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
When a container is force-removed, ocihook.Run("postStop") fails at
hostsstore.Release because RemoveContainer already deleted the files.
This causes the function to return early, never killing the port
reserver process. The port reserver holds host port sockets open,
causing clients connected to those ports to hang indefinitely.

Add fallback to manually kill the port-reserver process via its pid
file when postStop fails. Also revert debug logging flags from CI
test scripts.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Move killPortReserver call to before runPostStop in watchPostStop.
runPostStop acquires a mutex and runs the full ocihook.Run which can
be slow under contention. Killing the port reserver first ensures
clients connected to the container's mapped ports get an immediate
connection reset rather than hanging until the full teardown completes.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Add killPortReserver call in the Remove() handler after container
removal completes. The async postStop watcher's task.Wait() can be
delayed 10+ seconds under load, leaving port reservers alive and
causing clients to hang or port conflicts on the next container.

Also add removeCh fallback in attach handler to stop the log viewer
promptly when a container is force-removed before task.Wait() fires.

Re-enable SAM_DEBUG for CI diagnostic visibility.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
…apture

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Add millisecond-level timing to customStart and Remove for diagnosing
flaky failures under load. Restore full test suite (remove filters).

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Move ocihook.Run("createRuntime") from the container Start path to the
Create path. This eliminates ~200ms latency from Start, which caused
durable Lambda execution tests to fail due to timing-sensitive event
ordering in the emulator.

At Create time:
- Pre-create a named network namespace (/var/run/netns/<id>)
- Set the nerdctl/network-namespace label on the container
- Call ocihook.Run with PID=0 (uses netns annotation, not /proc/pid)

At Start time:
- Read the netns annotation from container labels
- Set spec.Linux.Namespaces[network].Path to join the pre-created netns
- Skip setupNetworking (already done)
- Container unpauses instantly with networking ready

At Remove time:
- Clean up the pre-created netns (umount + remove)

Signed-off-by: ayush-panta <ayushkp@amazon.com>
This reverts commit 088534e.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Pin the durable functions emulator to v1.1.1 to avoid upstream event
ordering regression in the latest image. SAM CLI unpinned this in
v1.162.0 (#9054) and their own CI is now failing the same way.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
Apply upstream fix from aws/aws-sam-cli#9097 — the emulator now reports
WaitForCallback instead of RunInChildContext. This patch can be removed
once a new SAM CLI release includes the fix.

Signed-off-by: ayush-panta <ayushkp@amazon.com>
@ayush-panta
ayush-panta force-pushed the feat/hookless-networking branch from e3b582f to 0bf581e Compare June 30, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant