c# - Mono SVN Post-Commit Hook not exiting when run under Apache -
we have ubuntu 14.04 lts svn server replacing our original windows 2003 server. both running svn via apache. part of deal our existing .net commit hooks ported on - these handle things such updating our project tracker , firing build jobs. part have succeeded - things run natively under mono. have installed mono-complete
on server.
when run under normal user on server, , sudo -u www-data
, hook runs , exits cleanly , correctly. have tried invoking mono env -
give empty environment, process still completes expected.
the problem comes when hook fires. mono invoked , program proceeds normal. however, not exit. have put extensive logging in program , returns main(), should returning exit code on completion. not happen; instead, hangs infinitely. performing strace
on process returns futex(0x982440, futex_wait_private, 0, null
sounds process waiting something. behaviour occurs in both .net 3.5 , .net 4.0.
the obvious problem here control not return svn until hook exits, client continues wait on commit.
the 1 thing have noticed there (but not always) appear 2 instances running when viewed in htop
, 1 running under apache, , second running directly under init. it's if mono has incompletely forked process. both have killed sigkill; not respond sigterm, , killing 1 not affect other.
i @ wit's end here. there no security limits set on processes. replacing main() returning int void , explicitly calling environment.exit() not work either. seems control not return hook system.
edit: have tried on debian 7 server set in same way , encounter same problem. both have mono-complete
installed. on ubuntu, v3.2.8. on debian, v2.10.8.1. stuck now.
edit 2: on advice of friend, set pch cron job see if lack of tty causing issue. works expected under cron , exits cleanly. no hanging processes. @ total loss explain this.
edit 3: on advie of friend, tried explicitly creating shell run pch:
#!/bin/bash if [ "$#" -ne 3 ]; echo "expected 3 arguments (given $#, values $*). use: $0 repository revision transaction" 1>&2; exit 1; fi logfile="/var/svn/postcommithook/postcommithook.log"; repo=$1; revision=$2; echo "$(date) starting post-commit $repo @ $revision" >> $logfile; author=$(svnlook author $repo -r $revision); echo "$(date) running post-commit hooks" >> $logfile; /bin/bash -c "/usr/bin/mono /var/svn/postcommithook/postcommithook.exe $repo $revision $author verbose < /dev/null >> $logfile 2>&1" if [ $? != 0 ]; echo "$(date) post-commit failed error code $? - commit has succeeded" >> $logfile; exit $?; fi echo "$(date) complete" >> $logfile;
no dice. still hangs. why won't process exit?
Comments
Post a Comment