1752646 Members
5678 Online
108788 Solutions
New Discussion юеВ

Strange Behaviour

 
Allanm
Super Advisor

Strange Behaviour


I have script which boots up one of the application and once I try to logout of the session from which I issued the script it just hangs, one of the SAs told me that there is a file descriptor that hangs.

Have you faced this situation before.
How I need to logout in order to escape the file desricptor.

Thanks,
Allan.
3 REPLIES 3
Allanm
Super Advisor

Re: Strange Behaviour

Please help!!

Thanks,
Allan
Steven Schweda
Honored Contributor

Re: Strange Behaviour

> Please help!!

You first.

It just might be helpful to know what "the
application" might be, and what's in "the
script", and even, perhaps, which OS you're
running.

If "the application" expects to talk to the
controlling terminal, and you whack the
controlling terminal by logging out, then
"the application" might have some trouble
continuing to run.

> Have you faced this situation before.

Is that a question. It's hard to say with so
little information about this situation?

> How I need to logout in order to escape the
> file desricptor.

Not sure what that means, but you may need to
redirect the input to "the application"
before you can log out. Some programs may
not lend themselves to being started in an
interactive mode, and then told to switch to
a batch mode.


> [...] boots up one of the application [...]

Also, I'm probably too old-fashioned, but
where I come from, an OS can pull itself up
by its own bootstraps, but a user just _runs_
an application, he doesn't boot it. (Unless
it's really bad, in which case he might boot
it out the door.)
Heironimus
Honored Contributor

Re: Strange Behaviour

Usually that happens because the process does not detach from its controlling terminal properly. When a process daemonizes it's supposed to close its stdin, stdout, and stderr file descriptors. If it doesn't do that your ssh logout will hang waiting for all of its file descriptors to close. It's usually safe to just close the session forcibly (click the close box or use a client escape sequence).

The "right" way to fix that specific problem is for whoever wrote the app to learn how to correctly daemonize a UNIX process. Failing that, you may be able to just redirect all the I/O when you start it or use some kind of wrapper that does it for you.