Access continues to run as a background task (1 Viewer)

JohnPapa

Registered User.
Local time
Today, 15:25
Joined
Aug 15, 2010
Messages
954
Suddenly I notice in the Task Manager that Access tasks continue to run in the background, after I exit the application with Application.Quit.

There is of course the nuclear option of a batch file running

Code:
cmd /c taskkill /F /IM "msaccess.exe"

which would kill all Access Tasks, something which is not very inviting.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:25
Joined
Feb 28, 2001
Messages
27,186
How are these Access tasks started? (Or do you know how they started?)
 

MarkK

bit cruncher
Local time
Today, 05:25
Joined
Mar 17, 2004
Messages
8,181
Look for collections or instances of objects you create that aren't adequately disposed of, particularly references to external object models. I've had exactly those symptoms you describe using an mscorlib.ArrayList, which I'd loaded with a bunch of AccessObject objects wrapped in a class, so I could sort them by DateModified. I needed to explicitly unload that ArrayList before shutdown.

Also, if you create two class instances, and each one holds a reference to the other, garbage collection will deem both instances still in use, even if in your code you have no valid references to either. I think this is also called a memory leak.

Those are the types of things to look for.
Merry Christmas,
 

JohnPapa

Registered User.
Local time
Today, 15:25
Joined
Aug 15, 2010
Messages
954
I simplified matters as much as possible.

I use A365 and I created a brand new db with one table and one form based on this table. The form has a button that executes application.quit (I also tried docmd.quit).

The background access task is still there. Logically, the culprit is A365.
 

JohnPapa

Registered User.
Local time
Today, 15:25
Joined
Aug 15, 2010
Messages
954
The good thing is that the background tasks take up 0% CPU. The only drawback is the memory they take up.
 

Minty

AWF VIP
Local time
Today, 13:25
Joined
Jul 26, 2013
Messages
10,371
I had this about 5 months ago. Randomly leaving an Access process running, on a string of different databases.
Looked for everything, did a full office repair, eventually fully uninstalled office and re-installed, made no difference.

Due to needing more storage space I eventually did bought a new SSD and did a new install of Win 11. Obviously fresh installs of office etc. Problem disappeared even though all the same databases were being used. I know that's not much help but it did indicate to me that something buried in the OS or left behind from the original Office install was the ultimately the culprit.
 
Last edited:

JohnPapa

Registered User.
Local time
Today, 15:25
Joined
Aug 15, 2010
Messages
954
I had this about 5 months ago. Randomly leaving an Access process running, on a string of different databases.
Looked for everything, did a full office repair, eventually fully uninstalled office and re-installed, made no difference.

Due to needing more storage space I eventually did bought a new SSD and did a new install of Win 11. Obviously fresh installs of office etc. Problem disappeared even though all the same databases where being used. I know that's not much help but it did indicate to me that something buried in the OS or left behind form the original Office install was the ultimately the culprit.
As I mentioned I am using at present A365. Will soon go to A21 when the product is released. May be forced to use

Code:
cmd /c taskkill /F /IM "msaccess.exe"

at some point.
 

JohnPapa

Registered User.
Local time
Today, 15:25
Joined
Aug 15, 2010
Messages
954
I also tried closing all elements forms, queries, tables etc before Application.Quit, but it did not help.
 

Minty

AWF VIP
Local time
Today, 13:25
Joined
Jul 26, 2013
Messages
10,371
As I mentioned I am using at present A365. Will soon go to A21 when the product is released. May be forced to use

Code:
cmd /c taskkill /F /IM "msaccess.exe"

at some point.

I'm on a O365 subscription and have been for a number of years, so I doubt it's a version related thing, although it could have been introduced with a specific build I guess.

Very frustrating, as I found the hanging process would stop certain things running correctly and had to get into the task manager to shut it down.
 

GPGeorge

Grover Park George
Local time
Today, 05:25
Joined
Nov 25, 2004
Messages
1,867
I have one accdb which does this, and no others that I use regularly. I use MS 365 as well. The particular accdb FE has a SQL Azure backend.

The problem is intermittent. Sometimes it hangs and sometimes it doesn't.

At one point I thought I had tracked it down to a procedure in a specific code module that continued to execute after it was supposed to have completed, but I could never isolate it. I know that, if I start the accdb, perform one or two tasks, and close it again, the hanging process does not occur. If I have opened multiple complicated forms and revisited some of them, it often hangs, but not always.

If I had time to invest, or a client to satisfy, I would try again to track it down.
 

Minty

AWF VIP
Local time
Today, 13:25
Joined
Jul 26, 2013
Messages
10,371
I have one accdb which does this, and no others that I use regularly. I use MS 365 as well. The particular accdb FE has a SQL Azure backend.

The problem is intermittent. Sometimes it hangs and sometimes it doesn't.

At one point I thought I had tracked it down to a procedure in a specific code module that continued to execute after it was supposed to have completed, but I could never isolate it. I know that, if I start the accdb, perform one or two tasks, and close it again, the hanging process does not occur. If I have opened multiple complicated forms and revisited some of them, it often hangs, but not always.

If I had time to invest, or a client to satisfy, I would try again to track it down.

I would also clarify that the databases concerned were all SQL Azure backends. We rarely work on Access stored data.
And that the same databases opened by either a colleague or clients didn't suffer the same issue, so it was definitely something local to my machine OS or office install.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:25
Joined
Feb 28, 2001
Messages
27,186
Thinking about this, I remember something that MAY be related. But it might not be that helpful.

Windows talks about "processes" as places to get things done. For Windows, in order for you to run code, that code must be in the context of a process. I.e. Code doesn't run in a software vacuum. All of the things you do are somehow recorded in the memory associated with/allocated to that process. In Task Manager, there is a Processes tab that lets you see all of the processes defined on your system.

When you terminate a process, part of that termination involves returning resources to their respective resource pools. During this termination, you will have user memory, display "resources", and some object-related data structures in system memory or other "flavors" of memory based on how and from where they were assigned. An important step is to get rid of all open I/O channels because they will hold links to data structures such as "handles" - which are often device-driver-related or file-related or network-socket-related.

The termination code enters what is called an "I/O rundown" to terminate all activity through each handle in turn. BUT... if certain operations are still under way, when you try to terminate handle activity to a cooperating process, that process CAN say "No" if for some reason it would lead to inconsistent system-level data. If you have already closed the display and keyboard channels - which usually DO close without a problem - it then becomes impossible to notify you that your terminating process isn't terminating. It gets hung in a failed I/O rundown with no way to advise you of that painful situation.

It is possible that a hung process will refuse to terminate even after a manual "kill" with Task Manager or with the CMD prompt commands mentioned earlier in this thread. The only way to clear such processes is to reboot. In such cases, you might see a notice on screen during the system shutdown that Windows is waiting for task X to terminate, and you might even see it ask for permission to force termination. If you see one of those and the process was one you THOUGHT you had already killed, it was probably hung in rundown.

Therefore, as a matter of conjecture rather than certainty, I would suggest that some patch has left open a path for Access to refuse termination due to a reluctant I/O channel (as identified by its handle). This refusal MIGHT appear in the system event log as seen through Event Viewer, though that is by no means a certainty.

I said earlier that my memory here might not be helpful. That is because if it IS a failed I/O rundown case, in extreme cases like this, there is nothing you can do short of a reboot. However, if the rundown failure was simply bad timing that led to something timing out, a later manual kill might work. But usually, when you get a process hung like this, it can no longer execute further self-cleanup because it enters that "rundown" state and at that point, it will no longer execute code. It is in an "involuntary" wait state that only Windows can release.

It MIGHT be possible to use Task Manager >> Processes to identify a hung process and to determine its internal process ID. You could then open up Resource manager (from Task Manager >> Performance, bottom of the screen) to see if you can identify any resources being held by that process. It MIGHT give you insight as to which connection failed. But I wouldn't hold my breath on that one.
 

Users who are viewing this thread

Top Bottom