Re: Horrible response to keyboardInterrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

--- James Antill <james-yum@xxxxxxx> wrote:

> Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx> writes:
> 
> > On Thu, 2008-09-11 at 19:32 -0700, CAI Qian wrote:
> >
> >> Correct. That is one of situations of bad CTRL-C response. I was
> trying
> >> to simulate a network failure or slow connection. It could be
> quite
> >> normal in reality.
> >> 
> >
> > Great, then please file this  against python.
> >
> > $ ipython
> > In [1]: import socket
> >
> > In [4]: socket.gethostbyname('www.phy.duke.edu')
> >
>
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C---------------------------------------------------------------------------
> > KeyboardInterrupt                         Traceback (most recent
> call
> > last)
> >
> > the socket call to gethostbyname does let you do an interrupt in
> the
> > middle of it - or at least - not at all times.
> 
>  Or don't :).
> 
>  Unless you can make the above work for C, bearing in mind:
> 

In fact, there is not absolute necessary to do an interrupt in the
middile of gethostbyname(3). It is acceptable to handle the interrupt
before it is going to try another mirror. The current behaviour is, no
matter how many and quickly CTRL-C typed, it kept trying all mirrors.

Downloading Packages:
^C^C^C^C^C^C^C^C^C^C^C^C^C^C
 Current download cancelled, interrupt (ctrl-c) again within two
seconds to exit.
^C^C^C^C^C^C^C^C^C^C
http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/development/x86_64/os/Packages/openoffice.org-draw-core-3.0.0-4.2.fc10.x86_64.rpm:
[Errno 4] IOError: <urlopen error (-2, 'Name or service not known')>
Trying other mirror.
http://fedora.secsup.org/linux/development/x86_64/os/Packages/openoffice.org-draw-core-3.0.0-4.2.fc10.x86_64.rpm:
[Errno 4] IOError: <urlopen error (-2, 'Name or service not known')>
Trying other mirror.
...

Cai Qian

> 1. gethostbyname¹ is "magic" and lives inside libc.
> 
> 2. A C-c/kill(SIGINT) is sent to a process via. calling whatever
> function is the SIG_INT function.
> 
> 3. The "default" behaviour of the SIG_INT function is just to
> immediately exit.
> 
> 4. You can't do much more than #3 within a signal handler, because
> you
> don't know what code you are running.
> 
> 5. #3 is unacceptable for pretty much any half decent program², and
> given #4 the only option is to communicate to the rest of the program
> within the signal handler. The rest of the code then periodically
> checks for this communication.
> 
> 6. Due to #1 and #5, gethostbyname/etc. cannot be interrupted
> within any half decent program.
> 
>  The only available solutions are:
> 
> 1. Run all resolving code in another process, which just does that
> (lots of code, and annoying as hell ... and all the code needs to
> call
> this special resolving code).
> 
> 2. Fix libc to have an "official" way to communicate the C-c to libc.
> 
> ...don't hold your breath on #1, and good luck with #2.
> 
> 
> ¹ Actually getaddrinfo, but meh.
> 
> ² Some apps. may not qualify as half decent by this measure, but
> meh. ... as they probably aren't ;)
> 
> -- 
> James Antill -- james@xxxxxxx
> _______________________________________________
> Yum mailing list
> Yum@xxxxxxxxxxxxxxxxxxxx
> https://lists.dulug.duke.edu/mailman/listinfo/yum
> 

_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux