Unable to get parent process (ignored)

1,374 views
Skip to first unread message

Raymond Rizzuto

unread,
Jun 7, 2013, 12:26:59 PM6/7/13
to topshelf...@googlegroups.com
I'm running an app using TopShelf as a console app, and I get "Unable to get parent process (ignored)" on startup because we use cmd.exe /c start <top shelf process>.  It sounds innocuous, but it is logged as an error.  Is it an issue?  If not, maybe it should be logged at an Info/Debug level instead?

Chris Patterson

unread,
Jun 7, 2013, 5:01:59 PM6/7/13
to topshelf...@googlegroups.com
I'm not sure, why are you using cmd.exe to run it? It's an .exe itself.


On Fri, Jun 7, 2013 at 9:26 AM, Raymond Rizzuto <ray.r...@gmail.com> wrote:
I'm running an app using TopShelf as a console app, and I get "Unable to get parent process (ignored)" on startup because we use cmd.exe /c start <top shelf process>.  It sounds innocuous, but it is logged as an error.  Is it an issue?  If not, maybe it should be logged at an Info/Debug level instead?

--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dru Sellers

unread,
Jun 7, 2013, 5:05:31 PM6/7/13
to topshelf...@googlegroups.com
Looks like we use it when we are trying to determine if running as a service.


Feel free to make a PR with what you would like it do instead. :)

If you need any help making the PR let me know.

-d


On Fri, Jun 7, 2013 at 11:26 AM, Raymond Rizzuto <ray.r...@gmail.com> wrote:
I'm running an app using TopShelf as a console app, and I get "Unable to get parent process (ignored)" on startup because we use cmd.exe /c start <top shelf process>.  It sounds innocuous, but it is logged as an error.  Is it an issue?  If not, maybe it should be logged at an Info/Debug level instead?

--

Raymond Rizzuto

unread,
Jun 7, 2013, 5:11:40 PM6/7/13
to topshelf...@googlegroups.com
Oh, the reason is that we use a scheduling system called Tidal, which doesn't like to kick off long running jobs.  We have Tidal use cmd.exe /c start so that the TopShelf-based process is disassociated from the Tidal parent.

As a work-around, I figured out that we can launch it this way to get the same effect, but leave the TopShelf-based process with a parent:

cmd.exe /c start cmd.exe /c <top shelf process>

Still, I am curious to know what that error message indicates, and if it is truly an error.

Raymond Rizzuto

unread,
Jun 7, 2013, 5:26:23 PM6/7/13
to topshelf...@googlegroups.com
The exception that is being caught is:

System.ArgumentException Process with an Id of 15196 is not running.    at System.Diagnostics.Process.GetProcessById(Int32 processId)

   at Topshelf.Runtime.Windows.WindowsHostEnvironment.GetParent(Process child) in d:\BuildAgent-01\work\830c5e1ad1d64d48\src\Topshelf\Runtime\Windows\WindowsHostEnvironment.cs:line 238

I'm using version 3.0.2 from  of TopShelf, so the line numbers in mine differ. It looks like the error occurs at this line:

return Process.GetProcessById(parentPid);

I think what is happening is that by the time that line executes, the parent has exited.  

I think it would be reasonable to wrap that call in a try/catch for System.ArgumentException, and return null.  I would suggest logging at Info or Debug level since the fact that the parent process is gone doesn't cause the program to misbehave.  

Raymond Rizzuto

unread,
Jun 7, 2013, 5:28:02 PM6/7/13
to topshelf...@googlegroups.com
Is PR a Pull Request or a Problem Report?  What is a Pull Request?

Dru Sellers

unread,
Jun 7, 2013, 5:32:36 PM6/7/13
to topshelf...@googlegroups.com

Dru Sellers

unread,
Jun 7, 2013, 5:34:08 PM6/7/13
to topshelf...@googlegroups.com
so basically, you can make the change that you want, and then send the pull request (PR) to us. The owner of the repo can then look at the exact code changes you want. If everything is happy, then they just pull your code in and you get the credit for the fix.

if its not happy, the owner can comment right on your changes in github - where the two of you can hash it out.

pretty sweet

-d
Reply all
Reply to author
Forward
0 new messages