darcs

Issue 465 darcs takes ages to respond to Ctrl-c in some states

Title darcs takes ages to respond to Ctrl-c in some states
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, isaacd, kowey, markstos, thorkilnaur, tommy
Assigned To
Topics

Created on 2007-05-23.14:58:25 by isaacdupree, last changed 2009-10-24.00:35:23 by admin.

Messages
msg1704 (view) Author: isaacd Date: 2007-05-23.14:58:21
E.g. in a GHC repo:
$ darcs pull
[type control-C soon but not immediately]
[wait a while - around 15 seconds in my case]
withSignalsHandled: Interrupted!
$

After typing ^C the system appears to have high network (not CPU) usage
for some time before quitting.

Waiting a long time, unresponsively, before quitting when requested, is
not nice behavior for a unix process :)

(also "withSignalsHandled: Interrupted!" seems odd to say;
"withSignalsHandled" is part of the implementation. "Interrupted by
signal X" or some such might be better?)

Isaac
msg1874 (view) Author: kowey Date: 2007-07-19.06:47:26
Thanks, Isaac.

Marking this as a bug, though probably not one that I would know how to fix. 
Note that this also occurs during optimize --reorder, where it would at least be
nice to get the 'Can't handle interrupt because darcs is doing a sensitive
operation'.

On the other hand, do note Isaac's comment about 'withSignalsHandled'.  It
should be fairly easy to replace that with something more user friendly.
msg2026 (view) Author: isaacd Date: 2007-08-08.10:55:56
I'm having similar problems with darcs push.  But it's hanging for several hours
trying to get to the GHC repo, so I press ctrl-C repeatedly, trying to stop it.
Eventually it says "darcs: too many pending signals" and quits without even
removing _darcs/lock.

If darcs handled signals promptly when it wasn't in the midst of sensitive
calculations, it wouldn't even need to quit for "too many pending signals" either.

But what about during optimize --reorder? If darcs has no choice but to exit
fast, is it possible to do it cleanly? At least, if the next time darcs starts
it recognizes that the repository is in the midst of an optimize --reorder, is
it possible to bring the repository to a consistent state from there?  If so,
then I believe it's a somewhat interruptible operation (although it would be
acceptable if the intermediate work were lost); otherwise I think it's a darcs
problem, not to be crash-safe.  I know I can manually make particular operations
crash-safe by making a backup copy in case something goes wrong; so maybe it
would be worth it for darcs to do something similar.  But can't darcs do all its
computation first, so any shuffling around of files needed, in which the
repository is temporarily inconsistent, doesn't take a particularly large amount
of time?
msg2027 (view) Author: droundy Date: 2007-08-08.16:53:36
isaacd: I suspect that the trouble with interrupting a darcs push is related to
an noninterruptable ssh operation.  Fixing this is probably quite tricky,
although it might be easy for the right person (which is not me).  Generally,
interactions with external programs are tricky, and I know of no easy/safe way
to interrupt them.

The issue with darcs optimize is different.  The real fix is to switch to a
repository format that is friendly to atomic changes, and that's what we're
working on.  The hashed-inventory format helps part of the way, and the
(planned) hashed-pristine format should finish this off.  Once we have a
naturally atomically-updateable repository format, the only challenging bit will
be updating the working copy, and that's something much less of an issue
(particularly with optimize!).

David
msg3281 (view) Author: markstos Date: 2008-02-09.19:20:39
David,

Would you agree that this is resolved about as much as it can be right now? The
hashed formats you mentioned have been implemented, and I'm sure that's much
that can be done about interrupting external operations. 

   Mark
msg3285 (view) Author: droundy Date: 2008-02-09.20:28:48
On Sat, Feb 09, 2008 at 07:20:40PM -0000, Mark Stosberg wrote:
> Would you agree that this is resolved about as much as it can be right now? The
> hashed formats you mentioned have been implemented, and I'm sure that's much
> that can be done about interrupting external operations. 

Yeah, may as well resolve this.  There are still a few potentially slow
operations, but interrupting a file-download is a risky business.  And it's
*far* better in the hashed repository than it was previously.
-- 
David Roundy
Department of Physics
Oregon State University
msg3287 (view) Author: isaacd Date: 2008-02-09.21:16:30
okay, in that case I guess I will just continue to type ctrl-C a dozen or so
times to terminate darcs pull/push operation.  This leaves the SSH operation
running and it will print a time-out message to the same terminal rather later,
but that doesn't seem to be a problem for me.  Is this the best user-interface
we can come up with, given current limitations?
msg3288 (view) Author: droundy Date: 2008-02-09.21:56:20
On Sat, Feb 09, 2008 at 09:16:31PM -0000, Isaac Dupree wrote:
> okay, in that case I guess I will just continue to type ctrl-C a dozen or so
> times to terminate darcs pull/push operation.  This leaves the SSH operation
> running and it will print a time-out message to the same terminal rather later,
> but that doesn't seem to be a problem for me.  Is this the best user-interface
> we can come up with, given current limitations?

Ah, so this is when running with ssh that you have trouble? In that case,
the problem is most likely that darcs never receives the sigint, since it
goes to the ssh/scp which fails (at least, I think that's what's
happening).  I'm not sure how to deal with this.  It's also possible that
when dealing with scp's we are catching and ignoring sigints, treating them
as if they were a generic ssh-related error (e.g. file on remote repository
doesn't exist).  What you describe is definitely a bug.  Are you running
with a darcs 2 prerelease? If so, could you try running with --debug and
see if you get output after hitting ctrl-C?
-- 
David Roundy
Department of Physics
Oregon State University
msg3290 (view) Author: isaacd Date: 2008-02-09.22:21:26
no, sorry, it's just the situation described before, pull via HTTP or push via
SSH are what I did, which make darcs say that thing about too many interrupts
after I press ctrl-C several times. (at which point I get a shell prompt again.)
 I haven't tried darcs2 and probably don't have time to, now.
msg3292 (view) Author: markstos Date: 2008-02-10.01:17:17
I just tried interrupting an HTTP pull with the darcs 2 pre-release, and darcs
returned immediately. The error return wasn't ideal, but I consider it good enough:

###

darcs: failed to read patch:
Wed Jul 12 15:18:09 EST 2000  jesse
  tagged v1-1
user error (failed to fetch:
http://mark.stosberg.com/darcs_hive/cgi-app/_darcs/patches/20000712201809-a5c95-2e8b213b949d7fcb26a0924cb461501ea31e6968.gz
ExitFailure 2)

####

The ideal error message wouldn't mention something like "darcs caught interrupt
signal. Exiting."

###

After I canceled the repo was left in a consistent state. Namely, no changes
were recorded. 

###

I'm marking as a resolved-in-unstable based on this experience and David's
feedback. 

Isaac: Please do re-open this ticket if you test with a Darcs-2 pre-release and
find that that the issue persists.
History
Date User Action Args
2007-05-23 14:58:25isaacdupreecreate
2007-07-19 06:47:33koweysetstatus: unread -> unknown
nosy: droundy, tommy, beschmi, kowey, isaacdupree
messages: + msg1874
title: darcs takes ages to respond to control-C in some states -> darcs takes ages to respond to Ctrl-c in some states
2007-08-08 10:55:57isaacdsetnosy: + isaacd
messages: + msg2026
2007-08-08 16:53:37droundysetnosy: droundy, isaacd, tommy, isaacdupree, kowey, beschmi
messages: + msg2027
2008-02-09 19:20:40markstossetnosy: + markstos
messages: + msg3281
2008-02-09 20:28:50droundysetnosy: droundy, tommy, beschmi, kowey, markstos, isaacdupree, isaacd
messages: + msg3285
2008-02-09 21:16:31isaacdsetnosy: droundy, tommy, beschmi, kowey, markstos, isaacdupree, isaacd
messages: + msg3287
2008-02-09 21:56:22droundysetnosy: droundy, tommy, beschmi, kowey, markstos, isaacdupree, isaacd
messages: + msg3288
2008-02-09 22:21:27isaacdsetnosy: droundy, tommy, beschmi, kowey, markstos, isaacdupree, isaacd
messages: + msg3290
2008-02-10 01:17:18markstossetstatus: unknown -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, markstos, isaacdupree, isaacd
messages: + msg3292
2008-09-04 21:31:01adminsetstatus: resolved-in-unstable -> resolved
nosy: + dagit
2009-08-06 17:47:58adminsetnosy: + jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, isaacdupree, isaacd
2009-08-06 20:43:44adminsetnosy: - beschmi
2009-08-10 22:04:34adminsetnosy: + isaacd, isaacdupree, - darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:00:46adminsetnosy: - dagit
2009-08-25 17:59:44adminsetnosy: + darcs-devel, - simon
2009-08-27 14:06:51adminsetnosy: tommy, kowey, markstos, darcs-devel, isaacdupree, thorkilnaur, isaacd, dmitry.kurochkin
2009-10-24 00:35:23adminsetnosy: - isaacdupree