Wanhao D4S via GPX Plugin, stuck in Cancelling on Cancel

What is the problem?
When printing, and its decided to cancel a print, OP is stuck in cancelling mode.

What did you already try to solve it?
Read thru FAQ, have seen the post regarding 1.3.7 problem that does not seems to be like my problem, atleast does not in the first tries.

Before last restart of Pi, the Fake Acknowledgement button did nothing to the problem, the "log position on cancel" and " Attempt to abort any blocking heatups on cancel via M108" have been enabled.

Now, after several rounds of testing, pressing Fake Acknowledgement twice (5 seconds apart) did nothing, on third try, the printer went XZ home, Y stood still. Seems like it did not run the cancelling script also, since Y should go down in the script.

Any help to get the "Cancel" functionality to work as expected (one Click, and job cancelled) is wanted,
serial log, and GPX verbose log attached.

Cancel script:
; **** Duplicator 4 dual end.gcode ****
M73 P100 ; end build progress
G1 Z150 F1000 ; send Z axis to bottom of machine
M140 S0 T0 ; cool down HBP
M104 S0 T0 ; cool down right extruder
M104 S0 T1 ; cool down left extruder
M127 ; stop blower fan
G162 X Y F3000 ; home XY maximum
M18 ; disable stepper
M72 P1 ; play Ta-Da song
; **** end of end.gcode ****

Wanhao D4S Cancelling Bug.zip (41.7 KB)

Additional information about your setup
OctoPrint version: 1.3.10
OctoPi version: 0.16.0
GPX plugin version: 2.6.3
printer: Wanhao D4S
firmware: 7.7

@markwal Provided the GPX verbose logs from your GPX plugin also, care to have a look? Thanks,

Try turning off the sound event in the Cancel script. It's possible that it's blocking in such a way so that control doesn't return to OctoPrint fast enough, creating a race condition.

In my own ending sound event, I had to adjust things so that upon firing off aplay that happened with an ampersand at the end of that command (meaning that this is to be forked and to run in the background).

@OutsourcedGuru Just tested your tip, still requires "Fake Acknowledgement " after cancel. It also does not run the cancelling script after this, only XZ home after "Fake Acknowledgement". Y stays as while printing.

You might want to review any of those commands which don't look familiar to me and determine if they're long-running or not.

Settings -> Serial Connection -> Firmware & protocol -> Protocol fine tuning -> Advanced options -> Long running commands

It's also good to review the closed issues on the OctoPrint repository to see if any of these sound like what you're seeing. https://github.com/foosel/OctoPrint/issues/2575

@OutsourcedGuru I am no able to identify the command it awaits answer to, are you able to point me in the right direction? From terminal during Cancel -> Cancelling -> Several "Fake Ack" -> Operational, I got the following output:

Send: N385 G1 X-5.701 Y-8.416 E0.5378*93
Recv: ok
Send: N386 G1 X-5.022 Y-8.416 E0.0183*91
Changing monitoring state from "Printing" to "Cancelling"
Recv:  T:210 /210 B:60 /60 T0:209 /210 T1:210 /210 @:0 B@:0
Recv:  T:210 /0 B:60 /0 T0:209 /0 T1:210 /0 @:0 B@:0
Recv:  T:210 /0 B:60 /0 T0:209 /0 T1:210 /0 @:0 B@:0
Recv:  T:210 /0 B:60 /0 T0:209 /0 T1:210 /0 @:0 B@:0
Recv:  T:210 /0 B:60 /0 T0:210 /0 T1:210 /0 @:0 B@:0
Recv:  T:210 /0 B:60 /0 T0:209 /0 T1:210 /0 @:0 B@:0
Recv:  T:211 /0 B:59 /0 T0:209 /0 T1:211 /0 @:0 B@:0
Recv:  T:210 /0 B:59 /0 T0:209 /0 T1:210 /0 @:0 B@:0
Recv:  T:211 /0 B:59 /0 T0:208 /0 T1:211 /0 @:0 B@:0
Send: N387 M105*43
Recv:  T:210 /0 B:59 /0 T0:208 /0 T1:210 /0 @:0 B@:0
Send: (@clear_cancel)
Recv:  T:209 /0 B:59 /0 T0:207 /0 T1:209 /0 @:0 B@:0
Recv:  T:209 /0 B:58 /0 T0:206 /0 T1:209 /0 @:0 B@:0
Send: N388 M73 P100*85
Recv:  T:209 /0 B:59 /0 T0:206 /0 T1:209 /0 @:0 B@:0
Recv: ok
Send: N389 G1 Z150 F1000*3
Recv: ok
Send: N390 M140 S0 T0*43
Recv: ok
Send: N391 M104 S0 T0*42
Recv: ok
Send: N392 M104 S0 T1*40
Recv: ok
Send: N393 M127*46
Recv: ok
Send: N394 G162 X Y F3000*70
Recv:  T:208 /0 B:58 /0 T0:206 /0 T1:208 /0 @:0 B@:0
Recv:  T:208 /0 B:58 /0 T0:204 /0 T1:208 /0 @:0 B@:0
Recv: ok
Send: N395 M18*21
Recv: ok
Changing monitoring state from "Cancelling" to "Operational"
Recv: ok
Send: M105
Recv: ok T:206 /0 B:58 /0 T0:201 /0 T1:206 /0 @:0 B@:0

I dunno. I just don't really recognize any of those M-related commands in your Cancel script. You might try adding all of them at first, restart OctoPrint, repeat your test and see if it works.