Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage resource leak

Zeng, Jeff 1 Reputation point
2021-03-23T05:50:44.907+00:00

Our product is a COM object and running under the control of COM+ service. The purpose of the COM object is to load a package from a .dtsx file and execute the package. For certain package, I found after Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage is called, some threads will be created. The call stack of the threads likes:
ntoskrnl.exe!KeSynchronizeExecution+0x5bf6
ntoskrnl.exe!KeWaitForMultipleObjects+0x109d
ntoskrnl.exe!KeWaitForMultipleObjects+0xb3f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!KeUnstackDetachProcess+0x2631
ntoskrnl.exe!ObDereferenceObjectDeferDelete+0x28a
ntoskrnl.exe!KeWaitForMultipleObjects+0x1284
ntoskrnl.exe!KeWaitForMultipleObjects+0xb3f
ntoskrnl.exe!KeWaitForMultipleObjects+0x4fe
win32kfull.sys!xxxUpdateInputHangInfo+0x5e2
0x0000000000000000
win32u.dll!NtUserGetMessage+0x14
user32.dll!GetMessageW+0x26
DTS.dll!DllUnregisterServer+0xd5443
MSVCR120.dll!beginthreadex+0x107
MSVCR120.dll!endthreadex+0x192
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21
After the package is executed, the threads are not released. So when our COM object processes a new package, more threads will be created and it cause memory/resource leak.
Does any one know how to release these threads or a loaded package?

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,457 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Monalv-MSFT 5,896 Reputation points
    2021-03-23T08:20:40.253+00:00

    Hi @Zeng, Jeff ,

    May I know if you can share the components in the ssis package?

    You can run Integration Services packages as needed or at predetermined times by using the methods described in Running Packages. However, with only a few lines of code, you can also run a package from a custom application such as a Windows Forms application, a console application, an ASP.NET Web form or Web service, or a Windows service.

    Please refer to the following links:
    1.Loading and Running a Local Package Programmatically
    2.Application.LoadPackage Method

    Best regards,
    Mona

    ----------

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.