How do I work around the "The process cannot access the file .ISPAC because it is being used by another process" error?
Asked Answered
I

5

20

I executed an SSIS package using SSDT and Visual Studio. When I try to execute another package I get an error saying "The process cannot access the file XXXX.ispac because it is being used by another process". I have tried rebooting but that is a pain in the behind. How can I work around this error?

SSIS pop up window:

enter image description here

Microsoft Visual Studio. Exception deserializing the package "The process cannot access the file '...' because it is being used by another process. (mscorlib)

Or another SSIS pop up window that you might also run into if you run a package:

enter image description here

Microsoft Visual Studio. Failed to execute the package or element. Build errors were encountered. For more information, see the Output window.

SSIS Output window:

enter image description here

Iliac answered 7/3, 2019 at 19:26 Comment(0)
T
7

You might check your patch level. I saw this much more frequently with the 2015 release of SSDT but hasn't bit me too often since then.

Finding and killing a process

Sysinternals has an excellent tool called Process Explorer. It's free, doesn't require an install and helps you see what all is happening on your computer. In this case, you want to find the process that has its grubby finger on your file (MyProject.ispac) and then kill it.

https://helpcenter.gsx.com/hc/en-us/articles/115015880627-How-to-Identify-which-Windows-Process-is-Locking-a-File-or-Folder

A different approach that doesn't require getting Process Explorer running is to change your build from Development to Release (and back again).

Chicken Sandwich No Pickles asks via comments

How can I convert from Development to Release?

In your tool bar, click where you see Development in the dropdown (or right click the solution in Solution Explorer)

enter image description here

In Configuration manager, you may/may not have a listing available under Configuration. Earlier versions of SSIS projects had dev/release configurations predefined but it looks like newer ones do not. If you do not have another option, make one via <New...>

enter image description here

Copy the values from the Development configuration et voilà!

enter image description here

Now when you debug, ProjectFolder/bin/Release will exist and the dtsdebughost.exe will latch onto that file and release the pointers to ProjectFolder/bin/Development/Project.ispac

Tenotomy answered 7/3, 2019 at 19:40 Comment(2)
How can I convert from Development to Release?Warmblooded
@ChickenSandwichNoPickles Added an explanationTenotomy
S
48

While developing an SSIS package I got the error “The process cannot access the file ‘.ispac’ because it is being used by another process”*.

Tried to close SSDT and run it again but, we still got the same error while compiling. Then, after searching over internet, we got the solution:

Solution :

  1. Go to Task Manager–> Details Tab.
  2. Locate the process "DtsDebugHost.exe".
  3. Kill this process.

enter image description here

There might be multiple instances of this process. Kill all of them. After doing this, I tried to compile the package again and it was successful.

You can do this without Admin rights. If you cannot get to the Task Manager with the keyboard shortcut, for example in a remote Terminal that is not in full screen, you can reach the the Task Manager with a right-click on the start menu button.

Somnambulism answered 12/2, 2021 at 6:54 Comment(2)
The process name for DtsDebugHost.exe in Task Manager might be seen as SSIS Debug Host.Micropaleontology
This works also if you do not have any Admin rights on a Terminal server. You can right-click on the start menu button to choose the Task Manager.Lockhart
T
7

You might check your patch level. I saw this much more frequently with the 2015 release of SSDT but hasn't bit me too often since then.

Finding and killing a process

Sysinternals has an excellent tool called Process Explorer. It's free, doesn't require an install and helps you see what all is happening on your computer. In this case, you want to find the process that has its grubby finger on your file (MyProject.ispac) and then kill it.

https://helpcenter.gsx.com/hc/en-us/articles/115015880627-How-to-Identify-which-Windows-Process-is-Locking-a-File-or-Folder

A different approach that doesn't require getting Process Explorer running is to change your build from Development to Release (and back again).

Chicken Sandwich No Pickles asks via comments

How can I convert from Development to Release?

In your tool bar, click where you see Development in the dropdown (or right click the solution in Solution Explorer)

enter image description here

In Configuration manager, you may/may not have a listing available under Configuration. Earlier versions of SSIS projects had dev/release configurations predefined but it looks like newer ones do not. If you do not have another option, make one via <New...>

enter image description here

Copy the values from the Development configuration et voilà!

enter image description here

Now when you debug, ProjectFolder/bin/Release will exist and the dtsdebughost.exe will latch onto that file and release the pointers to ProjectFolder/bin/Development/Project.ispac

Tenotomy answered 7/3, 2019 at 19:40 Comment(2)
How can I convert from Development to Release?Warmblooded
@ChickenSandwichNoPickles Added an explanationTenotomy
H
5

Here's a simple script you can run in powershell to kill all ssis debug process "DtsDebugHost.exe" and unlock the ispac file.

unlock_ispac.ps1

# if ssis error with 'The process cannot access the file ‘.ispac'
# run this file in powershell
get-process | foreach {
    $pName = $_
    if($pName.Name -eq "DtsDebugHost") {
        $pName.Kill()
    }
}
Hanna answered 6/7, 2022 at 15:28 Comment(0)
L
5

if anyone's in a hurry just run this in cmd prompt:

taskkill /im DtsDebugHost.exe /f

all other answers explain this well. this is just if you're looking to copy/paste something to get it over with :)

Command Prompt:

enter image description here

SUCCESS: The process "DtsDebugHost.exe" with PID 13744 has been terminated.
SUCCESS: The process "DtsDebugHost.exe" with PID 22368 has been terminated.

(This works even without admin rights in a remote terminal.)

Label answered 4/10, 2023 at 21:42 Comment(1)
This works even without admin rights in a remote terminal. Output for me is a 2-liner: SUCCESS: The process "DtsDebugHost.exe" with PID 13744 has been terminated. SUCCESS: The process "DtsDebugHost.exe" with PID 22368 has been terminated.Lockhart
L
0

Check if another debugging is running

I likely got this error since I had another debugging run of the same solution going on. I found out about this when I closed all VS windows, one window needed to be stopped from debugging although nothing ran:

enter image description here

That should be the ispac process that I had force closed with the help of the answers here - which then did not stop the debugging as well.

Thus, before you force close, check whether there might be another VS window with the same solution opened and running.

Linked Git errors

For the search keywords on the net, here are some Git errors that should be linked to the ispac error since I got them at the same time when I tried to git stash something.

enter image description here

git.exe stash push -m "..."

Unlink of file '...' failed. Should I try again?

enter image description here

git.exe stash push -m "..."
Saved working directory and index state On ...
error: unable to unlink old '...': Invalid argument fatal: Could not reset index file to revision 'HEAD'.

git did not exit cleanly (exit code 1)

Lockhart answered 8/7 at 13:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.