Re: program hangs after calling exit




"mar" <marvind434@xxxxxxxxx> wrote in message
news:1135111874.811838.307670@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> Thread 1 (Thread -1218497376 (LWP 27039)):
> #0 0x00eb7bc6 in _IO_flush_all_lockp () from /lib/tls/libc.so.6
> #1 0x00eb7f20 in _IO_cleanup () from /lib/tls/libc.so.6
> #2 0x00e74702 in exit () from /lib/tls/libc.so.6
> #3 0x00e5f7ff in __libc_start_main () from /lib/tls/libc.so.6
> #4 0x08050c21 in _start ()
>
> Here is the output of "thread apply all where" after attaching gdb to
> process 2:
> Thread 1 (Thread -1218501472 (LWP 28306)):
> #0 0x00b47c2e in _IO_flush_all_lockp () from /lib/tls/libc.so.6
> #1 0x00b47f20 in _IO_cleanup () from /lib/tls/libc.so.6
> #2 0x00b04702 in exit () from /lib/tls/libc.so.6
> #3 0x00aef7ff in __libc_start_main () from /lib/tls/libc.so.6
> #4 0x08050c21 in _start ()
>
> I ran these programs on RedHat Enterprise Linux 3.0 kernel 2.4.21-20. I
> am not sure why these processes are hanging after calling exit. This
> does not happen all the time - only after running these programs for a
> long time.
>
> I would appreciate any help in this matter.

It may be the context in which you are calling 'exit'. But what's
happening is that the 'exit' function is trying to clean up standard I/O and
some thread is still in the middle of a standard I/O operation. This can
commonly happen if you call 'exit' from a signal handler, but it can also
happen when a thread makes a blocking standard I/O operation that blocks for
a very long time (like reading from a keyboard or network connection).

DS


.



Relevant Pages

  • Re: program hangs after calling exit
    ... > It may be the context in which you are calling 'exit'. ... > some thread is still in the middle of a standard I/O operation. ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)
  • Re: Program receiving SIGSEGV after exit()
    ... The port "games/qudos" keeps running in a loop after exiting from the ... This is because after calling exit() the program receives a ... SIGSEGV signal, and the signal handler, after intercepting it, calls ... exit() again. ...
    (freebsd-hackers)
  • Re: Exit errors by subshells are ignored in most shells
    ... >> I'm not sure why you think that the exit code is being ignored. ... >> line calling exit is run in a subshell, so you should expect it to ... Actually I'm surprised if zsh doesn't ... to non-zero should make the parent shell exit. ...
    (comp.unix.shell)
  • Re: test/unit autorun fails to set exit status on failure
    ... anyway) to set the exit status. ... puts "Calling exit handler" ... $ ruby tmp.rb ... proc is called which, too, can call exit with a new status code. ...
    (comp.lang.ruby)
  • Re: My program dies. Exit code is 1918972463
    ... Gavin Maltby wrote: ... > Mikhail Teterin wrote: ... > I'd guess your program is not calling exit anywhere and instead of ... it is not supposed to exit _at all_. ...
    (comp.unix.solaris)