SShortSingh.
Back to feed

Why Your .NET App Silently Fails: The TCP Port Exhaustion Trap

0
·1 views

ASP.NET Core applications can suffer mysterious outbound API failures even when CPU, memory, and database metrics appear normal, with the root cause hidden at the TCP layer. Each new HttpClient instance created per request opens a fresh TCP connection requiring a unique local port, and closing connections does not immediately free those ports due to TCP's TIME_WAIT state. Under high traffic, an application can exhaust the finite pool of available outbound ports, triggering SocketException errors that disappear temporarily after a restart. Microsoft explicitly warns against creating and disposing HttpClient instances per request, recommending instead that developers reuse HttpClient or use IHttpClientFactory to share connection pools. Understanding this TCP lifecycle explains why the pattern is dangerous and helps developers recognize the same failure even across different technologies or frameworks.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How One Developer Ran Proxmox and Docker on the Same Windows Machine

A developer discovered that Windows Hypervisor Platform and nested Proxmox virtualisation are mutually exclusive, forcing Docker Desktop to fail whenever Proxmox was active. After AI tools only suggested choosing one option, the developer devised their own fix: offloading the Docker daemon entirely to a dedicated Ubuntu VM running inside VMware. The Windows Docker CLI was then configured to communicate with that remote VM via SSH context, bypassing the hypervisor conflict altogether. The setup uses Docker Engine 29.8.0 on an Ubuntu 24.04 VM with 4 vCPUs and 8 GB RAM, while Docker Desktop on Windows is retained solely for its CLI. A noted side effect is that disabling the Windows hypervisor also silently breaks WSL2, despite status commands appearing normal.

0
ProgrammingDEV Community ·

Droid ASC Android Reverse Engineering Tool Claims 269x Speed Gain Over jadx

Droid ASC is an open-source Android reverse engineering tool introduced at Black Hat Europe 2026 Arsenal, designed to address the slow decompilation and high memory demands of traditional tools like jadx. The tool uses a zero-index architecture and on-demand Deflate stream decompression to query APKs as live databases rather than exhaustively indexing them. Benchmark tests across four commercial APKs showed search speeds up to 269 times faster and memory consumption up to 125 times lower than jadx, with no disk caching required. In one test, jadx crashed with an out-of-memory error at 49% completion on a 352 MB APK, while Droid ASC returned results in under two seconds. The tool is aimed at penetration testers, red teams, and bug bounty researchers, and is recommended strictly for use in authorised testing environments.

0
ProgrammingDEV Community ·

How a Late-Night Dev Session Built a Cross-Project Log System That Now Spans 426 Files

A developer working with Claude Code created a session-tracking system during a brief early-morning session to solve the problem of continuity across multiple AI conversations. The system introduced a structured naming format, an index file, and an auto-closing script that logs session metadata including start time, status, and a UUID for resuming work. A third session the same day expanded the design, giving each session its own file with fixed sections for goals, decisions, and next steps, plus a script to list and query sessions at the start of each conversation. The system has since scaled to 426 session files across ten projects, with 165 created autonomously by agents running terminal tasks without the developer present. Core elements like the naming format and fixed section structure remain unchanged from that original night.

0
ProgrammingHacker News ·

Financial Times Sports a Clever Custom 404 Error Page

The Financial Times has drawn minor online attention for its custom 404 'Page Not Found' error page hosted at ft.com. The page was shared on Hacker News, where it received a small number of upvotes. The submission attracted no comments from the community. Custom error pages are often used by media and tech companies to maintain brand identity and user experience even when content is missing.

Why Your .NET App Silently Fails: The TCP Port Exhaustion Trap · ShortSingh