Urgent.News

What's breaking now, across thousands of outlets.

Tech

ThreadPoolExecutor result(timeout=1) Left 4 Calls Running

future.result(timeout=1) raises TimeoutError after one second, but the thread keeps running the call to the end, and future.cancel() returns False because the work already started; if a tool call must really stop, run it in a child process and terminate that process on timeout. In my test, four agent tool calls that each "timed out" after 1 s all ran their full 5 s, and the next 0.1 s call on the…

The ThreadPoolExecutor result(timeout=1) function raised a TimeoutError after one second, but the associated thread continued to execute the call all the way through, without stopping. The call to the cancel() method returned False, indicating that even though the timeout occurred, the work was not actually halted. This occurs because Python does not have a built-in mechanism for terminating a thread once it has begun execution.

The same issue arises when using asyncio.wait_for(to_thread(...), timeout=1), where the async function continues to run in the background after the timeout has been reached. The primary cost of this behavior is that when a pool of workers is fully occupied, any subsequent calls must wait in the queue until a worker becomes available, leading to increased latency.

This behavior is consistent across both ThreadPoolExecutor and asyncio implementations. To prevent this issue, the recommended solution is to execute the slow tool function in a separate process, which can then be terminated with a timeout. Alternatively, the individual call can include its own internal timeout, such as using a timeout parameter in the HTTP client or an asyncio.timeout context manager.

This approach ensures that the tool function stops running if it takes too long, avoiding unnecessary resources being consumed by the pool of workers.

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

Clerk Review 2026: Auth for Modern SaaS Startups

Authentication is the most deceptive time sink in SaaS development—what looks like a weekend implementation often turns into weeks of handling password resets, session management, OAuth providers, and…

WARN Act and Your Commuter Benefits — What Happens to Transit and Parking After a Layoff Notice

A WARN notice gives you at least 60 days' warning before a layoff takes effect. That notice period protects your paycheck and your time to plan. It does not protect one smaller benefit many commuters overlook: the pre-tax money sitting in your transit and parking account. In most plans, that balance disappears on your last day of work.

  • WARN Act mandates 60-day layoff notice
  • Commuter benefits forfeited upon layoff
  • Unused transit, parking funds lost to employer

Stop Partitioning Disks by Hand: Practical systemd-repart on Linux

Every hand-built Linux image eventually grows the same wart: a shell script that pipes commands into sfdisk , calls partprobe , runs resize2fs , and hopes the device really was /dev/sda . It works exactly once.

  • Systemd-repart manages disk partitions declaratively using .conf files
  • Tool is incremental, only changes matching partition definitions
  • Supports GPT only, no MBR/DOS, shrinking, moving, deleting, or filesystem growth

More from Saturday 21 November →