Main Content

Troubleshoot Invalid or Unresponsive Windows Change Notification Handles

MATLAB® uses a Windows® operating system feature called change notification handles to detect when files in an associated folder are modified. Under certain circumstances, Windows fails to provide MATLAB with a valid or responsive Change Notification Handle. The three most common causes for invalid or unresponsive change notification handles are:

  • Windows has exhausted its supply of notification handles.

  • The specified folder resides on a file system that does not support change notification. (Syntax TAS file server, SAMBA file server, and many NFS file servers are known to have this limitation.)

  • Network or file server latency delays the arrival of the change notification so that changes are not detected on a timely basis.

When MATLAB is unable to obtain a valid or responsive Change Notification Handle, it cannot automatically detect changes to files and folders. For example, new functions added to an affected folder might not be visible, and changed functions in memory might not be reloaded.

Control How MATLAB Detects Changes in Files and Folders

If MATLAB is unable to detect changes to your files and folders due to invalid or unresponsive change notification handles, you can control how MATLAB detects changes in folders.

If your file system updates folder timestamps when files are added to folders, you can set your system remote path policy to detect changes by testing the timestamps of folders. To do so, include these commands in a startup.m file. For more information on creating a startup.m file, see Startup Options in MATLAB Startup File.

system_dependent('RemotePathPolicy', 'TimecheckDir');
rehash path;
You might notice a performance degradation due to the time required to check the timestamps.

If your file system does not update folder timestamps (such as an NT file system), you can set your system remote path policy to detect changes by rereading the affected folders at frequent intervals. To do so, include these commands in a startup.m file.

system_dependent('RemotePathPolicy', 'Reload');
rehash path;
You might notice a significant performance degradation due to the time required to reread the folders.

To determine how MATLAB detects changes in folders, use this command:

system_dependent('RemotePathPolicy', 'Status');

In some cases, detecting new files or changed files in folders affected by the invalid or unresponsive change notification handles is not necessary. If detecting changes is not necessary, to provide maximum performance, you can disable your system remote path policy. To do so, include these commands in a startup.m file.

system_dependent('RemotePathPolicy', 'None');
rehash path;

Clear Functions from Memory

Sometimes, changing your system remote path policy is not effective in preventing problems related to remote file system caching or network latency. If MATLAB is still unable to detect the changes that you have made to a function, you can clear the old copy of the function from memory using the clear function. MATLAB reads the updated function the next time it is called.

Configure Change Notification Handle Warnings

To analyze which folders are affected by invalid or unresponsive Windows change notification handles, you can configure the number of warning messages issued by Windows. To do so, include one of these commands in a startup.m file. For more information on creating a startup.m file, see Startup Options in MATLAB Startup File.

  • Show warning messages for all invalid or unresponsive change notification handles.

    system_dependent('DirChangeHandleWarn', 'Always');

  • Only show the first warning message about invalid or unresponsive change notification handles.

    system_dependent('DirChangeHandleWarn', 'Once');

  • Never show warning messages about invalid or unresponsive change notification handles.

    system_dependent('DirChangeHandleWarn', 'Never');

To determine when Windows warns about invalid or unresponsive change notification handles, use this command.

system_dependent('DirChangeHandleWarn', 'Status');

See Also

|

Related Topics