You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Markus Henschel <ma...@gmx.de> on 2006/04/24 10:30:12 UTC

Apache refuses to execute hooks after a while in connection with websvn

Hello,

this will get a little bit longer as the problem seems to be some 
interference of different components.

I run an apache prefork 2.0.50 with subversion 1.3.1 on suse linux. The 
server worked flawlessly until I decided to install a pre commit hook 
checking for a valid log message and preventing case sensitivity problem 
with windows clients. It's this:


***************
#!/bin/sh

REPOS="$1"
TXN="$2"

# Make sure that the log message contains some text.
LOGMSGOK=1
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null || 
LOGMSGOK=0

if [ $LOGMSGOK = 0 ]; then
     echo "Empty log messages are not allowed." >&2
     exit 1
fi


#check for adding a file deffering only by case
$REPOS/hooks/check-case-insensitive.pl "$REPOS" "$TXN" || exit 1

# All checks passed, so allow the commit.
exit 0

***************


This hook does what it is proposed - for a time. I noticed that after 
running the server for a while sometimes a commit fails stating the 
pre-commit hook failed. There are several strange things about that:

1. The hooks are executed and reach the exit 0. I know that because when 
I output something to stderr before the "exit 0" it is displayed to the 
client.

2. The failing frequency increases to a point where all (pre-commit) 
hooks fail no matter what's in them. Even a dummy hook only containing 
"exit 0" will fail.

Unfortunately there are no more additional information in the apache 
logs even when the log level is increased to debug. It just states that 
a pre-commit hook failed with an empty error output. When I restart the 
apache everything is fine again for the moment but the problem reoccurs 
again after some uptime.

As the only other thing this apache is doing is WebSVN I tested if it 
had anything to do with it. I wrote a script that continuously wrote 
noise to a 1MB file and committed it every 3 seconds. This worked for 
hours but as soon as I started using websvn the problem occurred. When 
displaying the head revision of a text file in websvn and hitting 
refresh in the web browser very fast the problem occurred just 10 
seconds after the server was restarted. So I think WebSVN might have 
something to do with it as if it is trashing some resource on apache 
that disturbs the process of hook executing by mod_dav_svn.

My solution so far was to disable websvn completely. I don't really can 
experiment with different apache versions as I'm not the admin of the 
server (just for the apache and svn). Switching to svnserver is not an 
option as I will need the domain authentication feature of apache later.

I'd really appreciate any help. How can websvn interfere with 
mod_dav_svn that way? What could I try?

Thank you for your help.

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: hooks fail when php scripts are executed (was Re: Apache refuses to execute hooks after a while in connection with websvn)

Posted by Markus Henschel <ma...@gmx.de>.

Nick Thompson wrote:
>> pre-commit hook:
>> #!/bin/sh
>> echo "test output" >&2
>> exit 0

> Maybe I missed something, but that script should be...
> 
> #!/bin/sh
> /bin/echo "test output" >&2
> exit 0
> 
> ...shouldn't it?
> 

No, doesn't seem to be necessary on that system. The echo works anyway 
it is just to be sure the hook script is actually executed when it 
fails. But on the other hand ... I just tried it and it makes no difference.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: hooks fail when php scripts are executed (was Re: Apache refuses to execute hooks after a while in connection with websvn)

Posted by Nick Thompson <ni...@agere.com>.
On Thursday 27 April 2006 14:36, Markus Henschel wrote:
> I did as much as I could to get to my problem so I can now place a
> new question here:
>
> Situation:
> suse linux 9.2
> mod_dav_svn 1.3.1
> Apache 2.0.50 and 2.2
> php4 4.4
>
> FSFS repository
> pre-commit hook:
> #!/bin/sh
> echo "test output" >&2
> exit 0
>
> Description:
> When any php4 script is executed the above pre-commit fails
> although this should not be possible. It cannot be a permission
> problem or something like that as the hooks are not failing
> immediately. They fail in an increasing ratio dependent on the
> usage of php scripts executed simultaneously on the server and the
> amount of commits that take place.
>
> I hacked the subversion sources a bit to get more output when a
> hook fails so I know for sure:
>
> 1. The hooks are executed as "test output" is given to a client
> when the hook fails.
>
> 2. The call to apr_proc_wait gives exitwhy==APR_PROC_EXET but an
> exit code that is a a fairly large number that is different every
> time a hook fails.
>
> 3. There are no hanging hook visible when doning `ps ax`
>
> So the hook gets executed but the exit code itproduces is not what
> apr_thread_proc returns. To make sure there is no problem with the
> shell on that system I used a binary program that did the same as
> the hook script above but it didn't change anything.
>
> I cannot imagine how this all is possible. What else can I do about
> it. I cannot reinstall the system as it is a production server. Any
> comments what else I could try are welcome.

Maybe I missed something, but that script should be...

#!/bin/sh
/bin/echo "test output" >&2
exit 0

...shouldn't it?

-- 
> Nick Thompson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

hooks fail when php scripts are executed (was Re: Apache refuses to execute hooks after a while in connection with websvn)

Posted by Markus Henschel <ma...@gmx.de>.
I did as much as I could to get to my problem so I can now place a new 
question here:

Situation:
suse linux 9.2
mod_dav_svn 1.3.1
Apache 2.0.50 and 2.2
php4 4.4

FSFS repository
pre-commit hook:
#!/bin/sh
echo "test output" >&2
exit 0

Description:
When any php4 script is executed the above pre-commit fails although 
this should not be possible. It cannot be a permission problem or 
something like that as the hooks are not failing immediately. They fail 
in an increasing ratio dependent on the usage of php scripts executed 
simultaneously on the server and the amount of commits that take place.

I hacked the subversion sources a bit to get more output when a hook 
fails so I know for sure:

1. The hooks are executed as "test output" is given to a client when the 
hook fails.

2. The call to apr_proc_wait gives exitwhy==APR_PROC_EXET but an exit 
code that is a a fairly large number that is different every time a hook 
fails.

3. There are no hanging hook visible when doning `ps ax`

So the hook gets executed but the exit code itproduces is not what 
apr_thread_proc returns. To make sure there is no problem with the shell 
  on that system I used a binary program that did the same as the hook 
script above but it didn't change anything.

I cannot imagine how this all is possible. What else can I do about it. 
I cannot reinstall the system as it is a production server. Any comments 
what else I could try are welcome.

Thanks

Markus



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Apache refuses to execute hooks after a while in connection with websvn

Posted by Markus Henschel <ma...@gmx.de>.

Ryan Schmidt wrote:
> Try verifying your repository with "svnadmin verify" to see if it's 
> alright. "svnadmin recover" if necessary.
> 
> If you're using a BDB repository, consider switching to FSFS. I don't 
> think it's necessarily WebSVN that's causing the problem, but possibly 
> just any concurrent access from another process, possibly over a 
> different protocol. FSFS doesn't have problems with that; I believe BDB 
> does. See the FAQ for how to convert.
> 
> Please consider upgrading your Apache. 2.0.50 is almost two years old.
> 
> 
> 
> 

Sorry, I forgot to write that I use FSFS for all repositories. I already 
considered the concurrent access by websvn to be the problem. So I did a 
"svn cat ..." of a repository file on the server as it is the same thing 
websvn does when displaying a file doesn't it? This didn't cause any 
problems.

So after all apache is the most probable source of the problem? I'll 
consider an update then but I wanted to make sure it is really neccessary.

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Apache refuses to execute hooks after a while in connection with websvn

Posted by Markus Henschel <ma...@gmx.de>.

Ryan Schmidt wrote:
> On Apr 24, 2006, at 12:30, Markus Henschel wrote:
> 
>> This hook does what it is proposed - for a time. I noticed that after 
>> running the server for a while sometimes a commit fails stating the 
>> pre-commit hook failed. There are several strange things about that:
>>
>> 1. The hooks are executed and reach the exit 0. I know that because 
>> when I output something to stderr before the "exit 0" it is displayed 
>> to the client.
>>
>> 2. The failing frequency increases to a point where all (pre-commit) 
>> hooks fail no matter what's in them. Even a dummy hook only containing 
>> "exit 0" will fail.
>>
>> Unfortunately there are no more additional information in the apache 
>> logs even when the log level is increased to debug. It just states 
>> that a pre-commit hook failed with an empty error output. When I 
>> restart the apache everything is fine again for the moment but the 
>> problem reoccurs again after some uptime.
> 
> Try verifying your repository with "svnadmin verify" to see if it's 
> alright. "svnadmin recover" if necessary.
> 
> If you're using a BDB repository, consider switching to FSFS. I don't 
> think it's necessarily WebSVN that's causing the problem, but possibly 
> just any concurrent access from another process, possibly over a 
> different protocol. FSFS doesn't have problems with that; I believe BDB 
> does. See the FAQ for how to convert.
> 
> Please consider upgrading your Apache. 2.0.50 is almost two years old.
> 
> 
> 
> 

I did as you suggested:
1. Updated Apache to 2.2.0
2. Updated php4 to 4.4
3. the other things do not apply as it is a FSFS repository

As soon as I execute ANY php scripts my pre-commit hooks start failing 
as written before. I installed the same version of subversion on another 
machine running gentoo and everything is just fine there. So what else 
could be wrong? I really have no idea what might be borked as there is 
no informative output.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Apache refuses to execute hooks after a while in connection with websvn

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 24, 2006, at 12:30, Markus Henschel wrote:

> This hook does what it is proposed - for a time. I noticed that  
> after running the server for a while sometimes a commit fails  
> stating the pre-commit hook failed. There are several strange  
> things about that:
>
> 1. The hooks are executed and reach the exit 0. I know that because  
> when I output something to stderr before the "exit 0" it is  
> displayed to the client.
>
> 2. The failing frequency increases to a point where all (pre- 
> commit) hooks fail no matter what's in them. Even a dummy hook only  
> containing "exit 0" will fail.
>
> Unfortunately there are no more additional information in the  
> apache logs even when the log level is increased to debug. It just  
> states that a pre-commit hook failed with an empty error output.  
> When I restart the apache everything is fine again for the moment  
> but the problem reoccurs again after some uptime.

Try verifying your repository with "svnadmin verify" to see if it's  
alright. "svnadmin recover" if necessary.

If you're using a BDB repository, consider switching to FSFS. I don't  
think it's necessarily WebSVN that's causing the problem, but  
possibly just any concurrent access from another process, possibly  
over a different protocol. FSFS doesn't have problems with that; I  
believe BDB does. See the FAQ for how to convert.

Please consider upgrading your Apache. 2.0.50 is almost two years old.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org