vmaf-gui icon indicating copy to clipboard operation
vmaf-gui copied to clipboard

Closing the application doesn't end the process and a few other bugs

Open vonH opened this issue 3 years ago • 7 comments

Hello,

Straight to the point:

  • Once the VMAF score has been presented and the log.xml opened and shown to the user, exiting VMAF-GUI by pressing the 'x' doesn't end the process. The exe is still running.
  • Exiting midway through a comparison closes the application, but leaves the ffmpeg process running and continuing the decompress the file(s).

vonH avatar Feb 10 '22 22:02 vonH

Once the VMAF score has been presented and the log.xml opened and shown to the user, exiting VMAF-GUI by pressing the 'x' doesn't end the process. The exe is still running.

Could you clarify? Does the form close but the process still shows as running in task manager?

Exiting midway through a comparison closes the application, but leaves the ffmpeg process running and continuing the decompress the file(s).

I'll need to add a handler for when the form is closed so I can kill the currently running job, good catch

ThatNerdUKnow avatar Feb 11 '22 06:02 ThatNerdUKnow

Could you clarify? Does the form close but the process still shows as running in task manager?

Yes, the form/window closes but the process is not terminated.

I'll need to add a handler for when the form is closed so I can kill the currently running job, good catch

Excellent and thank you. This piece of software is like a rare gem. It does exactly what you state it's meant to, and it performs the task well, with only a few minor issues.

vonH avatar Feb 11 '22 12:02 vonH

Yes, the form/window closes but the process is not terminated.

I cloned the repo to my machine and tested and I experienced the same. This is likely due to the fact that ffmpeg or vmaf was launched by vmaf-gui and is considered by the OS to be part of vmaf-gui

ThatNerdUKnow avatar Feb 11 '22 14:02 ThatNerdUKnow

Here's a couple of events recorded by Windows. There's not much of use here, but some of the information should be useful.

Application: vmaf-gui.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException at System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean) at System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[]) at System.Windows.Forms.Control.Invoke(System.Delegate) at vmaf_gui.Form1+<>c__DisplayClass7_0.<button1_Click>b__0() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()

Application: vmaf-gui.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ComponentModel.Win32Exception at System.Diagnostics.Process.StartWithCreateProcess(System.Diagnostics.ProcessStartInfo) at System.Diagnostics.Process.Start() at vmaf_gui.Form1.ChildProcess(System.String, System.String, Boolean) at vmaf_gui.Form1.vmaf(System.String, System.String, Boolean, Boolean) at vmaf_gui.Form1+<>c__DisplayClass7_0.<button1_Click>b__0() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()

vonH avatar Feb 11 '22 16:02 vonH

I assume the unhandled exception is caused by manually killing ffmpeg from task manager? Or is it caused by closing the form?

ThatNerdUKnow avatar Feb 11 '22 17:02 ThatNerdUKnow

I've attempted to resolve this by aborting the Thread that handles each child process and I've tried to kill the currently running child process on the form close event. I'm not super experienced with C#. Fixing this issue seems to be beyond me at this point. I'm very much leaning at this point towards archiving this repo after redoing it in electron

ThatNerdUKnow avatar Feb 12 '22 17:02 ThatNerdUKnow

Modifying this method to return the process handler should enable us to use the Kill method on form close https://github.com/ThatNerdUKnow/vmaf-gui/blob/master/vmaf-gui/Form1.cs#L18 Actually, it might be better to create a vector of process handlers as a member of the Form1 class and call the Kill method on each handler on form close. When the ChildProcess function is called we can simply push the process handler into the member

ThatNerdUKnow avatar Jul 28 '22 19:07 ThatNerdUKnow