Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Event 1530: user registry handles leaked at sign-out (User Profile Service, Application log)

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

On a Windows server where people sign in and out, such as a remote desktop host, the Application log shows event 1530 from the User Profile Service (source profsvc). Microsoft documents a message of this form, in which the number of handles, the process ID, the program path and the security identifier (SID) differ on your server:

  • 3 user registry handles leaked from \Registry\User\S-1-5-21-...-1004_Classes:
  • Process 2428 (\Device\HarddiskVolume1\myprocess.exe) has opened key \REGISTRY\USER\S-1-5-21-...-1004

This is logged as a warning, not an error. Microsoft describes the behaviour as by design and puts the investigation on the application. What the event gives you is the name of a program that is holding a user's registry open. The steps below find that program without changing anything.

What the error means

When a user signs out, Windows tries to close the user's profile. If an application still has a registry handle to that profile open, Windows closes the handle for it. Microsoft's page says: "This behavior occurs because Windows automatically closes any registry handle to a user profile that is left open by an application. Windows does this when Windows tries to close a user profile."

Microsoft's page adds a note: "Event ID 1530 is logged as a Warning event. The application that is listed in the event detail is leaving the registry handle open and should be investigated." Its status line reads: "This behavior is by design."

The page also describes one case: a service or background service that uses a user-specific hive because it runs under a specific user identity, when that user account signs out. The next section reads the event line by line.

Microsoft's page shows the event header as: Provider name "Microsoft-Windows-User Profiles Service", EventSourceName "profsvc", EventID 1530. The message part has two lines. The first gives how many user registry handles leaked and from which hive path. The second names the process, with its ID and executable path, and the registry key involved. The page also explains the case behind the event: "If a service or background service uses a user specific hive because it runs under a specific user identity and the relevant user account logs out."

Reading it field by field makes the report to a vendor short and exact:

Field in the event What it tells you
Level: Warning Microsoft's page: logged as a Warning event, not an error
Provider and source (profsvc) The User Profile Service wrote it, at the moment it tried to close the profile
Count of handles and hive path How many handles were left open, and in which user's registry
Process ID and executable path The program that holds the key and did not close it
Key named in the second line The registry key the program was holding

Likely causes

Cause What you see How to confirm
An application leaves a registry handle open The event names a process and a program path The path in the event belongs to a program you recognise
A service runs under a user identity The process is a service, and the event appears when that user signs out The process ID in the event is a service, below

Microsoft's page documents these two. It gives no further causes. If several events name the same program path, that points to one program, but the page does not say so.

Prove the cause before changing anything

All of these only read.

  1. List the events. This command is adapted from Microsoft's Get-WinEvent page, which gives Get-WinEvent -FilterHashtable @{ LogName='Application'; StartTime=$Date; Id='1003' } for the Application log. The values here are LogName and Id only:
Get-WinEvent -FilterHashtable @{ LogName='Application'; Id=1530 } -MaxEvents 20
  1. In each event, read the three things Microsoft's page shows: how many handles were leaked, the process ID and program path, and the registry key named. Note the date and time, and which user signed out.
  2. See whether the process is a service. Microsoft's tasklist page gives a filter on process ID and a /svc option that lists the services in each process. Use the process ID from the event:
tasklist /svc /fi "PID eq 2428"

If the process has already ended, nothing is listed. The program path in the event still names the program. Microsoft's tasklist page says /svc lists all the service information for each process without truncation, and that PID is a valid filter name with the operator eq.

  1. To see which handles a process has open, Microsoft's Sysinternals Handle page describes a utility that displays open handles for any process and needs administrative privilege. Its -a option dumps information about all types of handles, not just those that refer to files, and the page lists registry keys among those types. Its -p option narrows the scan to the processes whose names begin with the text you give, and the usage line on the page also accepts a process ID. Run it only while the process is running, and replace the process ID with the one from the event:
handle -a -p myprocess.exe
handle -a -p 2428

The page also lists -u, which shows the owning user name when searching for handles, and -s, which prints a count of each type of handle open. Neither changes anything.

Example (illustrative): at contoso.com.au a remote desktop host rds01 logs eleven event 1530 warnings each evening. All name the same path, C:\Program Files\VendorSync\sync.exe. Step 3 shows that the process is a background service that runs as one named staff account. That matches the page's description of a service that uses a user hive because it runs under a specific user identity.

What to send to the vendor of the program, in one message: the full event text, the date and time, the process ID and path, and the output of the tasklist and handle commands above if the process was still running. State that Microsoft's page describes the behaviour as by design and puts the investigation on the application. Do not describe the event as a Windows fault.

Fix

Microsoft's page gives no setting, command or update that stops the event, and says it is by design. Its guidance is that the application should be investigated. The steps are therefore decisions, with no change to Windows:

  • Decide whether the warning matters. Microsoft's page treats it as a warning that Windows handles by closing the handle. It does not say that the warning on its own causes sign-out problems or profile damage.
  • If the program is yours or your vendor's, report the event text to the vendor, with the program path and the handle count. The event shows that the application leaves the handle open.
  • If the process is a service running under a user account, the page's description is that it uses that user's hive. Ask the vendor whether the service needs to run under a user identity.

Handle can close a handle with its -c option. That option is left out on purpose. The Handle page warns: "Closing handles can cause application or system instability." The event does not need it.

No step above changes the server, so no save-first or back-out applies. If you or the vendor change how a service runs, record the service's configuration first and keep a way back, in the same way you would for any change to a service.

Confirm the fix

  • After the vendor's update or change, sign a test user in and out, then run the step 1 command again. No new event 1530 names that program.
  • The count of events per evening falls.
  • If the warning remains, the program path in it tells you the program is still leaving a handle open.

What to watch afterwards

  • A new program path appearing in the events after a software installation or update.
  • The number of leaked handles in the message. A growing number per sign-out is a reason to push the vendor.
  • Whether the same user's sign-out is always the one logged.

Risks and limits

These steps have not been run or lab-tested. Microsoft's page is short. It gives the message, the cause and the status "by design", and it gives no fix, names no version numbers and gives no figure for how common the event is. It says nothing about whether the event is related to slow sign-out or to temporary profiles, so no such link is made. Microsoft's page documents no policy setting that changes how profiles are unloaded.

Sources