Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD randomly uses 100% CPU

9 REPLIES 9
Reply
Message 1 of 10
peeveen
1571 Views, 9 Replies

AutoCAD randomly uses 100% CPU

We have written a small test executable which does the following:

 

1) Launch autocad using the command line "acad.exe /product ACAD /b startup.scr"
2) Observe the CPU usage of the acad process for 30 seconds.
3) If the last 10 seconds of CPU usage average more than 40%, quit and show an error.
4) Kill the acad.exe process and repeat.

 

Contents of startup.scr can be just some comments.

 

We have found that, randomly, acad.exe will attempt to grab all CPU usage (90%+) ... we have observed this behaviour within as little as 3 iterations, and as many as 440. The test was executed on a Windows 10 VMware machine.

 

Launching acad.exe without the /b switch ran for over 1000 iterations without error before we stopped it, so it is definitely related to that startup switch. I notice that using this switch automatically creates a blank drawing, so that may be related.

9 REPLIES 9
Message 2 of 10
Alfred.NESWADBA
in reply to: peeveen

Hi,

 

>> attempt to grab all CPU usage (90%+)

Please start command _DESKTOPANALYTICS ... if the checkbox is activated, then uncheck it.

 

If that does not help and you see the /b switch as the one making this happening then please show us the script.

Also most important: which version of AutoCAD (command _ABOUT ==> screenshot) do you have?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 3 of 10
peeveen
in reply to: Alfred.NESWADBA

I have unchecked the checkbox, and am running the test again at the moment.

The script is a text file that contains a single semi-colon (;) comment.

The test was run with AutoCAD 2020.1, though this behaviour has been witnessed on earlier versions.

As I type, the test has failed on iteration 5.

Message 4 of 10
peeveen
in reply to: peeveen

A little video of the error occurring after 4 runs.

 

https://www.youtube.com/watch?v=cOPkbLAFGQE

Message 5 of 10
Alfred.NESWADBA
in reply to: peeveen

Hi,

 

what is reporting that "waiting for all LMU processes to disappear"?

And with "LMU" ... is that referring to license manager?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 6 of 10
peeveen
in reply to: Alfred.NESWADBA

Yeah, I noticed that there were 3 instances of the LMU.exe process after running for a while, so I added some code to my test to remove those processes in case they were somehow the cause of the fault, but I can reproduce the error whether I kill these processes or not.

Message 7 of 10
Alfred.NESWADBA
in reply to: peeveen

Hi,

 

can you upload the files you are using for the scanning of processor power as well as the start-bat from AutoCAD as well as the script you have.

I don't see (if the script you are using with /b only contains 😉 what closes AutoCAD and restarts it.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 8 of 10
peeveen
in reply to: Alfred.NESWADBA

I'm running the test using a small C# executable to launch, monitor and kill AutoCAD:

 

using System;
using System.Diagnostics;
using System.Threading;

namespace acadWatcher
{
	class Program
	{
		static void Main(string[] args)
		{
			int runCount = 0;
			for (; ; )
			{
				++runCount;
				Console.Out.WriteLine("Attempt #" + runCount);
				Process p = new Process();
				p.StartInfo.FileName = "C:\\Program Files\\Autodesk\\AutoCAD 2020\\acad.exe";
				p.StartInfo.Arguments = "/product ACAD /b \"C:\\users\\steve\\desktop\\startup.scr\"";
				p.Start();
				string processName = p.ProcessName;
				Console.Out.WriteLine("AutoCAD launched (process name = " + processName + ").");
				PerformanceCounter pc = new PerformanceCounter("Process", "% Processor Time", processName);
				float usage = pc.NextValue();
				float[] usages = new float[30];
				// For 30 seconds, check every second for the CPU usage.
				for (int f = 0; f < 30; ++f)
				{
					Thread.Sleep(1000);
					usage = pc.NextValue();
					usages[f] = usage;
					Console.Out.WriteLine("" + (f < 9 ? " " : "") + (f + 1) + ": CPU usage = " + (int)usage + "%");
				}
				// Test average of last 10 seconds.
				float total = 0;
				for (int f = 20; f < 30; ++f)
					total += usages[f];
				float average = total / 10;
				Console.Out.WriteLine("Average CPU usage over last ten seconds was " + (int)average + "%");
				if (average > 40)
				{
					Console.Out.WriteLine("This EXCEEDS the given limit of 40%. Stopping.");
					break;
				}
				p.Kill();
			}
		}
	}
}

Here is the contents of the startup script, just one empty comment line. The main purpose of this is so that AutoCAD launches with an empty drawing rather than the usual startup window.

;

I ran a test yesterday that went for 660 iterations. I'm not sure, but I think it's because the mouse pointer was sat on the windows taskbar for almost the entire run, and not anywhere near the AutoCAD window. As soon as I put the mouse pointer over the main desktop area where the AutoCAD window was appearing, it failed within two runs ... so I'm thinking it might possibly be related to graphics/rendering?

Message 9 of 10
Alfred.NESWADBA
in reply to: peeveen

Hi,

 

you should not kill a process, instead create an AutoCAD script, that e.g. draws a line and then use command _QUIT to exit AutoCAD in a normal way (and watch the event to continue when the acad.exe process ended). Killing a process like AutoCAD that uses a lot of sub-tasks (e.g. licensing check) might leave one or the other task open.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 10 of 10
peeveen
in reply to: Alfred.NESWADBA

The thing is that we've been seeing AutoCAD do this CPU thing randomly through normal usage ... and by "normal" I mean launching with the "/b" switch to run a script that NETLOADs our custom addin (we've also seen the error occur using registry entries to autoload the addin). This automated program is just a way to test it more efficiently.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report