How to Fix the ERROR_TIMER_NOT_CANCELED Bug Check

Restarting the app that is causing this error should fix the problem temporarily

Reading time icon 3 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

How to fix ERROR_TIMER_NOT_CANCELED

The ERROR_TIMER_NOT_CANCELED bug check is a Windows system error code with the value 541 (0x21D). This error usually comes with the message An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine.

This error typically occurs when a program or system process tries to delete or stop a timer that is still active or in use, but the attempt fails. It is often encountered in scenarios involving scheduled tasks, timers, or asynchronous operations in software applications.

How do I fix the ERROR_TIMER_NOT_CANCELED bug check?

1. Check Task Manager for running processes

  1. Press Ctrl + Shift + Esc to open Task Manager.
  2. Look for processes related to the application that encountered the error.
  3. Select the process and click End Task.

This error may be caused by stuck processes that still run although you’ve closed the app. If you didn’t try it yet, you should also restart the app that is causing the problem or restart the system. Also, we recommend checking for any updates of the system and app.

2. Run System File Checker (SFC)

  1. Press Windows + S, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Type the following command and press Enter: sfc /scannow
  3. Wait for the scan to complete and follow any on-screen instructions to repair corrupted files.
  4. Restart your system if instructed to do so.

3. Debug and fix the timer code (for developers)

  1. Check Timer Creation and Cancellation Logic:
    • Ensure every timer is properly canceled or deleted before exiting the application.
    • Example for Windows API (C++): if (!DeleteTimerQueueTimer(NULL, hTimer, NULL)) { DWORD error = GetLastError(); printf("Error: %lu\n", error); }
  2. Verify Thread Synchronization:
    • Use locks or mutexes to manage concurrency when multiple threads access the same timer.
  3. Use Debugging Tools:
    • Add logging or breakpoints to ensure timers are being managed correctly.

4. Perform a Clean Boot

  1. Press Windows + R, type msconfig, and hit Enter.
  2. Go to the Services tab, check Hide all Microsoft services and click Disable all.
  3. Go to the Startup tab and click Open Task Manager.
  4. Disable all startup items, then restart your computer and check if the error persists.

5. Update the device drivers

  1. Press Windows + X and select Device Manager.
  2. Update all device drivers, especially for peripherals or hardware connected to the application.
  3. To do that, right-click a device, select Update Driver and choose Search automatically for drivers.

The ERROR_TIMER_NOT_CANCELED bug check may also be caused by old or corrupted drivers. Manually updating them can take a lot of time, especially if you don’t know which one is affected. Perhaps you should think about using a driver updater tool that will do all that automatically, with just a few clicks from your part.

By following these steps, you should be able to identify and resolve the ERROR_TIMER_NOT_CANCELED issue effectively. Let us know in the comments below if you need more information.

More about the topics: Error Code

User forum

0 messages