On Feb 8, 2006, at 22:10, Josh Kuo wrote:
>>>>>> To duplicate a problem, put 'sleep 20' in your
>>>>>> post-commit hook script. Then do a commit. The commit
>>>>>> will hang for 20 seconds on 'Transmitting file data .'
>>>>>> step.
>>>>>> I run Subversion 1.3 on Apache 2.0.55 on Slackware
>>>>>> 10.2.
>>>>>
>>>>> You need to make sure that the backgrounded job closes its
>>>>> stdout and
>>>>> stderr filehandles. Something like:
>>>>>
>>>>> my-process > /dev/null 2>&1 &
>>>>>
>>>>> Once that is done, the process should be backgrounded correctly.
>>>>
>>>> Unfortunately, that didn't do the trick.
>>>>
>>>> I tried:
>>>> sleep 20 > /dev/null 2>&1 &
>>>>
>>>> and committing a file still pauses for 20 seconds.
>>>
>>> I tried the same thing in my post-commit script and I don't get a 20
>>> second delay.
>>
>> What OS and version of Apache/Subversion are you using?
>
> OS: Debian sarge (upgraded to 2.6.13 kernel)
> Apache: 2.054
> SVN: 1.1.4
>
> If you want, you can send me the post-commit script and I'll take a
> look...
Ah, now this topic is interesting to me. For the longest time I've
wanted to spawn off a process in a post-commit hook to do some extra
work after the commit is done, without making the client wait for it,
but I never got around to trying it. Well thanks to this thread, now
I have, and I also can't get the post-commit hook to relinquish
control back to the client until the spawned process is completed.
My repository is in /tmp/repo. Here's the post-commit hook:
#!/bin/sh
REPO="$1"
REV="$2"
/tmp/repo/hooks/countdown.sh "${REPO}" "${REV}" >/dev/null 2>&1 &
And here's countdown.sh:
#!/bin/sh
REPO="$1"
REV="$2"
for ((i=5; i>0; i-=1)); do
sleep 1
echo `date` REPO=${REPO} REV=${REV} PID=$$ I=$i >> /tmp/svnlog.txt
done
And then in one window I monitor svnlog.txt:
tail -f /tmp/svnlog.txt
And in another, I change a file in a working copy and commit it:
echo `date` > foo && svn ci -m ""
It outputs this:
Sending foo
Transmitting file data .
And I get the countdown in the log file. And only after the countdown
finishes does the commit finish:
Committed revision 7.
This is Subversion 1.3.0 with APR 1.2.2 compiled through DarwinPorts
on Mac OS X 10.4.4 PPC. It's an FSFS repository created just now for
testing, accessed via the file:// protocol.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Feb 8 22:42:45 2006