Hello Guest it is November 14, 2019, 11:15:29 AM

Author Topic: Mach4 won't shut down  (Read 1025 times)

0 Members and 1 Guest are viewing this topic.

Mach4 won't shut down
« on: January 18, 2018, 05:00:52 PM »
Hi folks.
MACH4-3841-hobby-demo.
XP PC within spec.
Whenever I shut down MACH4 (weather a demo time out, or not) the screen goes blank as normal but evidently MACH4 is running in the background somewhere.
I go to restart and a window pops up saying its already running.
I have to go to the Task Manager to end the process, then it will restart normally.
I have let it set for nearly an hour to see if something needs to finalize, but it is still running. NO load or CPU usage indicated though.
Is this typical ? or, is there a fix ?
Thanks,
Russ
 :)

Re: Mach4 won't shut down
« Reply #1 on: January 18, 2018, 05:24:17 PM »
Hi Russ,
yes its a common issue. If Mach does not shut down gracefully part of it will hang up and prevent you from restarting.

When you are coding some new function when you can easily crash Mach it is very common.

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach4 won't shut down
« Reply #2 on: January 18, 2018, 10:05:14 PM »
I have this issue as well (win 7 & win 10)

I cant remember if power-shell runs on WinXP, but others may find this useful.  I made a power-shell script to kill the process, which is a bit easier and faster than opening task manager, finding the process and killing it every time you want to restart Mach4.
here is the code:
Code: [Select]
Get-Process | Where-Object { $_.Name -eq "Mach4GUI" } | Select-Object -First 1 | Stop-Processjust cut and past this into a text file and change the extension to .PS1

Offline smurph

*
  • *
  •  1,149 1,149
  • "That there... that's an RV."
    • View Profile
Re: Mach4 won't shut down
« Reply #3 on: January 18, 2018, 10:22:02 PM »
The problem is most likely a LUA script that is not terminating or a plugin hanging it up.  You can test if it is a plugin by disabling them one at a time and seeing if you can close Mach.  I have never seen Sim hang Mach up, so don't worry about disabling that one. 

There was a post where the modbus plugin was preventing a shutdown.  TOTALLYRC had that one.  It turned out that the polling frequency was too fast for his machine.  He turned the frequency down and all was well. 

Steve
Re: Mach4 won't shut down
« Reply #4 on: January 18, 2018, 10:55:03 PM »
Hi Russ,
quite easy to crash the Lua Editor, you have to try a bit harder to crash part of Mach.

I may not be a good source of 'right' solutions but I could write a book about 'bad' ones!

I was trying to test a piece of code and elected to put a wx.wxMessageBox in the PLC script. Mistake, now
every few milliseconds the PLC script would run and I would have to dismiss the messagebox and I could never
get to the ScreenEdit page to undo my mistake.

Daz-the-Gaz pointed me in the right direction, run Mach.exe from the command prompt using the /p switch and
Mach opens imediately which allows you to correct your mistake. I've done it and I understand just about every Lua
programmer has done something similar...

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach4 won't shut down
« Reply #5 on: January 18, 2018, 11:16:09 PM »
I don't think this is from anything I did. Its done this since the initial install.
I did later change the script just slightly in the Go TO Work Zero button and enabled the one DRO to be edited in place ... but that made no difference.
Where do I reduce the modbus polling frequency Steve mentioned ? I'll check the plugins tomorrow.

Where would I put the file mkullman posted ?

Thanks gents,
Russ
Re: Mach4 won't shut down
« Reply #6 on: January 19, 2018, 03:35:55 AM »
Where would I put the file mkullman posted ?

that's up to you. I keep it on the desktop, right next to the Mach4 Launcher icon.
Re: Mach4 won't shut down
« Reply #7 on: January 19, 2018, 07:59:17 AM »
Where would I put the file mkullman posted ?

that's up to you. I keep it on the desktop, right next to the Mach4 Launcher icon.

Oh, OK.
Cool, thanks,
Russ

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Re: Mach4 won't shut down
« Reply #8 on: January 19, 2018, 12:37:30 PM »
I think the first thing I would do is to create a new profile using the blank screen set then  close down mach4 and check that the core isnt still running, if all is ok then you know its nothing to do with xp then start adding what plugins you need 1 by 1 shuting down mach between each one until you get to the state of the core still running on shutdown. Its too easy to ignore the problem and manually force the core to shutdown. 9/10 times you can guarantee its a lua fault

DazTheGas
Theres always time for a choccy biccy
Re: Mach4 won't shut down
« Reply #9 on: January 19, 2018, 03:14:22 PM »
I like your approach Daz, nip it in the bud instead of working around it.
I'll see if I can find it.
Thanks,
Russ