question

ZengJeff-0760 avatar image
0 Votes"
ZengJeff-0760 asked Monalv-msft edited

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

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Monalv-msft avatar image
1 Vote"
Monalv-msft answered Monalv-msft edited

Hi @ZengJeff-0760 ,

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.



· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

80489-validations.xml


I uploaded the package file. I have the same issue if I load the package in a console application.

0 Votes 0 ·
validations.xml (109.5 KiB)

Hi @ZengJeff-0760 ,

It seems that the package file is broken.

Please find the initial ssis project and load the existing project to a solution.

Please refer to Add Copy of Existing Package and Add an existing project to a solution.

Best regards,
Mona


0 Votes 0 ·

81361-validations.xml


Our customer provided a .ispac file to me and I uploaded the new package file.

0 Votes 0 ·
validations.xml (109.6 KiB)

81228-thread.jpg


I used my console application to load the new package file and the threads will be created again. Any idea why the threads will be created?

0 Votes 0 ·
thread.jpg (204.3 KiB)

We have some customized tasks and used in the package. I tried to remove these tasks from the package and use the console application to load it again. There were less MSVCR120 threads created. The customized tasks inherit from Microsoft.SqlServer.Dts.Runtime.Task. Do I need to implement some methods or interfaces in the customized tasks so that the threads can be released?

0 Votes 0 ·