Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vonH opened this issue Feb 10, 2022 · 7 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@vonH
Copy link

vonH commented Feb 10, 2022

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).
@ThatNerdUKnow
Copy link
Owner

ThatNerdUKnow commented Feb 11, 2022

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

@vonH
Copy link
Author

vonH commented Feb 11, 2022

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.

@ThatNerdUKnow
Copy link
Owner

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 ThatNerdUKnow added the bug Something isn't working label Feb 11, 2022
@vonH
Copy link
Author

vonH commented Feb 11, 2022

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()

@ThatNerdUKnow
Copy link
Owner

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

@ThatNerdUKnow
Copy link
Owner

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 ThatNerdUKnow added the help wanted Extra attention is needed label Feb 14, 2022
@ThatNerdUKnow
Copy link
Owner

ThatNerdUKnow commented Jul 28, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants