How to cleanup Python directories Launchpad service

Eric Bezemer 181 Reputation points
2023-02-07T15:50:18.53+00:00

I have installed the Python 3.7 machine learning feature in SQL Server but the memory growth is huge after executing several Python scripts.

When you execute a SQL job with a python statement the launchpad creates folders in the MSSQL\ExtensibilityData\MSSQLSERVER01 with some files in it, but when the script ends the files are gone but the directories are still there and after a while there is a huge ammount of folders that will consume a lot of memory.

This from the EXTLAUNCHERRORLOG:

2023-02-07 16:22:28.853 GrantPermissionToExternalLibrary failed. ScriptType: 1. Error Code: 0x80070490

2023-02-07 16:22:28.853 GrantPermissionToExternalLibraryDirectories() failed. Error Code: 0x80070490

2023-02-07 16:22:31.119 RevokePermissionToExternalLibrary failed. ScriptType: 1. Error Code: 0x80070490

2023-02-07 16:22:31.119 RevokePermissionToExternalLibraryDirectories failed. Error Code: 0x80070490.

2023-02-07 16:22:31.134 Failed to delete files in directory G:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ExtensibilityData\MSSQLSERVER01\4E8F0405-1A4A-47DA-9F2F-9E2650FCD88B with HR 0x80070005.

2023-02-07 16:22:31.134 Failed to delete directory G:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\ExtensibilityData\MSSQLSERVER01\4E8F0405-1A4A-47DA-9F2F-9E2650FCD88B with HR 0x80070091.

From the pythonlauncher.log:

[2023-02-07 15:05:56.726][00001B04][00002AC8][Always] ScaleRJobCleaner.Start() successfully started thread 7252 [00001C54].

[2023-02-07 15:05:56.726][00001B04][00002AC8][Always] ProcessPoolTrimmer.Start() successfully started thread 10484 [000028F4].

[2023-02-07 15:05:56.726][00001B04][00001C54][Always] ScaleRStaleJobCleaner::Worker(0000024251F0B7B0) started successfully.

[2023-02-07 15:05:56.726][00001B04][000028F4][Always] ProcessPoolTrimmer::Worker(0000024251F016D0) started successfully.

[2023-02-07 15:05:56.726][00001B04][00002AC8][Always] StaleDirectoryCleaner.Start() successfully started thread 7040 [00001B80].

[2023-02-07 15:05:56.742][00001B04][00002AC8][Always] ComputerName=SE94ADETLDB01

[2023-02-07 15:05:56.742][00001B04][00002AC8][Always] SystemRoot=C:\Windows

[2023-02-07 15:05:56.742][00001B04][00002AC8][Always] User=NT SERVICE\MSSQLLaunchpad

[2023-02-07 15:05:56.742][00001B04][00002AC8][Always] UserProfile=C:\Users\MSSQLLaunchpad

[2023-02-07 15:05:56.742][00001B04][00002AC8][Always] Users=0

[2023-02-07 15:06:35.117][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:06:35.117][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:06:36.695][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:06:36.695][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:06:39.039][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:06:39.039][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:21.603][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:21.603][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:23.275][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:23.275][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:25.603][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:13:25.603][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:27.181][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:27.181][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:28.775][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:28.775][00001B04][00001F78][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:31.119][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

[2023-02-07 15:22:31.119][00001B04][00001EDC][Error] Process::TryTerminate failed with error code: 5

I have granted everyone with full rights to the folder above, but still the directories stay in place when executing python scripts in sql server. The only way to delete the folders is by hand and also when you restart the launchpad service.

Can someone help me with this?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,714 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 101K Reputation points MVP
    2023-02-07T22:52:32.1233333+00:00

    Have you granted access to ALL APPLICATION PACKAGES? If not, try that.


  2. Seeya Xi-MSFT 16,436 Reputation points
    2023-02-08T03:05:56.4866667+00:00

    Hi @Eric Bezemer ,

    Seeing error 5 makes me think of an access denied error. Although not necessarily the same as error 5 here, I would like to mention that the SQLRUserGroup group and MSSQLLaunchpad account needed "Read & Execute" access to the R_SERVICES folder.

    Best regards,

    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".