SShortSingh.
Back to feed

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

0
·33 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 ·

Seven Practical Pitfalls When Running Playwright Behind Residential Proxies

Basic tutorials that only set a proxy server often produce low success rates in production, according to this practitioner write-up. Proxy credentials passed through environment variables or manual routing can break HTTPS while plain HTTP still works, so authentication should be configured directly in the browser launch. Locale, timezone, and viewport settings should match the proxy's exit location, since mismatches are an easy bot signal, and WebRTC must be configured so it does not leak the real IP. The author also argues that patching headless detection signals by hand is costly to maintain, that contexts should be created per task to avoid cookie leakage, and that waiting for a specific element works better than waiting for network idle. Finally, the piece recommends blocking unnecessary resources to cut per-GB costs and escalating carefully when blocked, while respecting robots.txt and site terms.

0
ProgrammingDEV Community ·

Defense contract data reaches public databases about 90 days after awards are announced

A Pentagon contract becomes public on the day it is awarded, when the Defense Department posts it on its daily 5 p.m. Eastern contracts list, and companies may also announce it themselves the same day. The federal contract database, however, typically records the award about 90 days later, so backtests dated by that record can misplace events by roughly three months. Civilian agency awards appear in the database within about three business days, making the database a convenient but delayed source. The author's analysis of 3,029 award days from 2015 to 2026 found no measurable trading reaction for large contractors, while smaller firms under $2 billion saw elevated trading volume after new awards. The author notes the 90-day lag reflects the published rule plus a single check of the public feed, and that some records may arrive later.

0
ProgrammingDEV Community ·

Developer launches paid Chrome extension for local SEO audits and lead scraping

A local SEO and automation consultant built LocalPulse, a Chrome extension that audits Google Business Profiles on Maps across 11 checks and scores listings out of 100. It also collects public listing details from Maps searches and exports them to CSV for prospect lists. The developer used a FastAPI license server on Render that validates keys through Dodo Payments and keeps Pro features server-side to prevent bypassing. Early lessons included adding confirmed versus verify scoring, fixing regional Google domain and parsing bugs that unit tests missed, and resolving a payment provider rejection by publishing product, privacy, terms and refund pages. Pricing is $12 per month or $99 per year for the Pro tier.

0
ProgrammingDEV Community ·

Why Suppressing Conflict Hurts Agile Teams, and a Four-Step Approach to Managing It

An article on DEV Community argues that disagreement during Agile work, such as debates over code reviews or sprint commitments, is a normal and useful sign of engagement rather than a failure. It warns that leaders who rush to smooth over friction push tensions underground, where they breed resentment and apathy. The piece describes how unaddressed conflict erodes psychological safety, stalls decisions, and hides technical debt. It recommends separating ideas from personal identity by focusing on systemic goals and surfacing silent disagreements through anonymous retrospectives and targeted one-on-one questions.