Urgent.News

What's breaking now, across thousands of outlets.

Tech

The .NET HTTP Failure Nobody Sees Coming -Najeeb Ullah

Your CPU is fine. Your memory is fine. Your database is fine. So why did the application suddenly stop calling another service? There is a class of production failure that is particularly dangerous because your application metrics can look completely healthy while the application is already running out of a critical resource. The symptoms often look like this: outbound API calls start timing out…

In certain production scenarios, an ASP.NET Core application processing payments might suddenly stop calling external services. Symptoms include timeouts, latency increases, and intermittent request failures. Despite CPU, memory, and database appearing healthy on monitoring dashboards, the root cause often lies within the application's TCP connection management.

The issue arises from repeatedly creating and disposing HttpClient instances, leading to exhaustion of operating system's ephemeral port range used for local source ports. When connections are closed, TCP enters TIME_WAIT state to protect against delayed packets, which can cause a shortage of available ports if connections are established faster than they can be recycled.

This results in a high rate of connection failures and timeouts. The misunderstanding lies in believing that using HttpClient or implementing IHttpClientFactory resolves the issue. While these recommendations are valuable, they do not address the underlying problem. The true culprit is the creation of new connection pools for every request, rather than reusing existing ones.

To mitigate this issue, developers should optimize TCP connection management by reusing HttpClient instances and considering DNS changes that may affect connection stability.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

My checker blamed the other tool, and the defect was in the one doing the blaming

A verifier went red and named a neighbouring tool as the cause. Three of eight rows could not be matched, and the reason code said the rows had the wrong shape. Two things were wrong with that.

  • Three out of eight rows failed to match in verification tool
  • Reason code misleadingly blamed neighboring tool for defect
  • Fix involved removing line numbers and ensuring one block per row

Creating Adaptive Flutter Screens and Widgets

Flutter enables you to deploy a single application across phones, tablets, desktops, and the web. The challenge lies in designing an interface that feels purposeful on each platform.

  • Material Foundation package provides DynamicLayoutBuilder and DynamicScaffold widgets.
  • DynamicLayoutBuilder selects widget based on screen width (mobile, tablet, desktop).
  • DynamicScaffold incorporates adaptive behavior within SafeArea and Scaffold.

More from Saturday 12 September →