SShortSingh.
Back to feed

How a Missing CancellationToken in ASP.NET Core Caused Thread Pool Exhaustion Under Load

0
·41 views

A .NET developer discovered a subtle but serious bug while reviewing an ASP.NET Core codebase that was showing mysterious latency spikes and sluggish performance under high traffic. The application used a fire-and-forget pattern, returning a 202 Accepted response immediately while offloading heavy work to a background task without passing a CancellationToken. When traffic peaked at around 1,000 requests per second, up to 1,000 concurrent background tasks were hitting a slow third-party API, saturating the default HttpClient connection pool. Because no cancellation context was propagated, background tasks continued running even after clients disconnected, and subsequent CPU-bound work queued up until the thread pool hit its maximum limit. The fix involved passing a CancellationToken into the background task and adding explicit checks within the work loop so the operation could be cancelled when no longer needed.

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 ·

Arabic RTL CSS audit: two of three rules didn't work as intended

A developer who added Arabic support to their app with a short set of right-to-left CSS rules later audited it and found two of the three did not behave as expected. Testing in Chrome 156 with a probe page showed that the flex-direction rule for the tab bar actually cancelled the mirroring that RTL already applies, so the tab order stayed the same as in English. The text-align rule for inputs was also found to be unnecessary, since direction on an ancestor already aligns the text correctly. The developer shared the measurements and a checklist meant for any app shipping an RTL locale.

0
ProgrammingDEV Community ·

WriteFreely Instances: 49 Title Matches Raise Admin Claim and API Token Concerns

ZoomEye returned 49 title matches for WriteFreely on November 4, 2026, but none for the application fingerprint, so the count may not capture full coverage. Researchers note that in some WriteFreely setups the first user to log in becomes administrator, which is risky if an instance is exposed before that role is claimed. Operators are advised to confirm admin status, check whether federation and open registration are enabled, and ensure anonymous visitors cannot create a second admin path. API tokens tied to publishing accounts should be inventoried, kept out of public code, rotated when contributors leave, and kept out of logs. The 49 results are presented as a bounded set for owners to compare against their own domain inventories, not as a confirmed vulnerability list.

0
ProgrammingDEV Community ·

What 108 Gumroad Bestsellers Revealed About Pricing Digital Products

A creator analyzed 108 top-ranked products across 14 keywords on the Gumroad marketplace, tracking live prices and rating counts as a proxy for sales volume. The data showed Notion templates clustering into three price tiers, playbooks typically selling between $20 and $90, and design assets ranging from $36 to $99. Bestsellers in crowded categories often priced below the category median, apparently to accumulate reviews that drive discovery on the platform. The creator then launched nine products on November 1 priced below category medians and reported zero sales by day three, while promoting a paid dataset and discount code.

0
ProgrammingDEV Community ·

How engineers may grow when AI tools write the first draft of code

The author argues that AI coding tools now produce most first drafts of small programming tasks, removing the incremental ladder through which engineers traditionally learned the craft. Lessons once gained from routine fixes, such as code organization, review, testing, and shipping, must now be arranged deliberately by managers. Judgment, such as spotting wrong interpretations, duplication, or performance problems, is seen as developing through reading more code than one writes and learning from public mistakes. The author suggests designing growth paths around more reading, review, and explaining, and perhaps keeping some tool-free work early on. The author admits uncertainty about how long any by-hand period should last and whether newer engineers will develop comparable judgment.