1. Sebastian Sebastian
  2. scm-manager

Issues

Issue #327 resolved

Repository "does not appear to be an hg repository" after upgrading to 2.5.0

DRayX
created an issue

After upgrading to mercurial 2.5.0 earlier today, everybody started seeing the following when they tried to clone/push/pull to/from the repository:

abort: 'http://<server>/scm/hg/<repo>' does not appear to be an hg repository:
---%<--- (no content-type)

---%<---
!

I checked the scm manager logs, and there was nothing to indicate an error had occurred, and it appears that the transactions actually complete. When I served up the same repository with hg serv, everything worked fine, and there was no abort message. I did a pull with --debug, and found the following:

requested URL: 'http://<server>/scm/hg/<repo>?cmd=listkeys'
abort: 'http://<server>/scm/hg/<repo>' does not appear to be an hg repository:

My deployment is as follows:

Operating System: Ubuntu 12.04.2 LTS

Mercurial: 2.5.0

SCM-Manager: 1.27 (WAR deployment)

Tomcat: 7.0.26

Java: 1.7.0_09

Python: 2.7.3

Plugins: scm-auth-ldap-plugin 1.18

Any help would be greatly appreciated

Comments (13)

  1. DRayX reporter

    Here is the part of the trace logs that appear to be relevant:

    20:55:26.660 [http-bio-80-exec-755] DEBUG sonia.scm.web.cgi.DefaultCGIExecutor - execute cgi: python -O /var/lib/scm/lib/python/hgweb.py
    20:55:26.660 [http-bio-80-exec-755] TRACE sonia.scm.web.cgi.DefaultCGIExecutor - Environment:
      TERM=linux
      HTTP_VARY=X-HgArg-1
      JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
      TOMCAT7_USER=tomcat7
      HTTP_ACCEPT_ENCODING=identity
      SERVER_NAME=<server>
      PWD=/var/lib/tomcat7
      SERVER_PROTOCOL=HTTP/1.1
      SCM_CHALLENGE=(is set)
      CATALINA_BASE=/var/lib/tomcat7
      TOMCAT7_GROUP=tomcat7
      VERBOSE=no
      SCRIPT_NAME=/scm/hg
      PATH=/bin:/usr/bin:/sbin:/usr/sbin
      REMOTE_HOST=172.31.2.171
      HTTP_HOST=<server>
      CATALINA_TMPDIR=/tmp/tomcat7-tomcat7-tmp
      PATH_INFO=/<repo>
      QUERY_STRING=cmd=listkeys
      CATALINA_PID=/var/run/tomcat7.pid
      HTTP_X_HGARG_1=namespace=bookmarks
      HTTP_USER_AGENT=mercurial/proto-1.0
      PATH_TRANSLATED=/var/lib/tomcat7/webapps/scm/<repo>
      CONTENT_TYPE=
      HTTP_AUTHORIZATION=(is set)
      SHLVL=2
      HTTP_ACCEPT=application/mercurial-0.1
      AUTHBIND_LEVELS=y
      LD_PRELOAD=/usr/lib/authbind/libauthbind.so.1
      PYTHONPATH=/usr/local/share/hgext:/var/lib/scm/lib/python
      UPSTART_JOB=rc
      SERVER_SOFTWARE=scm-manager/1.27
      JAVA_OPTS=-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
      SCM_CREDENTIALS=(is set)
      UPSTART_INSTANCE=
      REPO_NAME=<repo>
      SCRIPT_FILENAME=/var/lib/tomcat7/webapps/scm/scm/hg
      AUTHBIND_LIB=/usr/lib/authbind/libauthbind.so.1
      _=/usr/share/tomcat7/bin/catalina.sh
      REQUEST_METHOD=GET
      runlevel=2
      HTTPS=OFF
      UPSTART_EVENTS=runlevel
      OLDPWD=/tmp/tomcat7-tomcat7-tmp
      SERVER_PORT=80
      previous=N
      JSSE_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/
      REMOTE_ADDR=<ip>
      SCM_URL=http://<server>/scm/hook/hg/
      RUNLEVEL=2
      CATALINA_HOME=/usr/share/tomcat7
      PREVLEVEL=N
      REMOTE_USER=<user>
      AUTHBIND=yes
      HOME=/usr/share/tomcat7
      GATEWAY_INTERFACE=CGI/1.1
      AUTH_TYPE=BASIC
      SCM_REPOSITORY_PATH=/var/lib/scm/repositories/hg/<repo>
      CONTENT_LENGTH=-1
      LANG=en_US.UTF-8
    20:55:27.137 [http-bio-80-exec-755] TRACE sonia.scm.web.cgi.DefaultCGIExecutor - handle status code 0 with statusCodeHandler, there are 0 bytes written to outputstream
    20:55:27.138 [http-bio-80-exec-755] DEBUG sonia.scm.web.HgCGIExceptionHandler - mercurial process ends successfully
    
  2. Sebastian Sebastian repo owner

    It looks like version 2.5.0 does not resend the request, if the url /scm/hg/repo?cmd=capabilities returns error code 401. In earlier versions mercurial has resend the request with authentication informations.

  3. DRayX reporter

    Cool, thanks Sebastian. For now, I just patched the wsgicgi.py file with the following:

    --- a/mercurial/hgweb/wsgicgi.py    
    +++ b/mercurial/hgweb/wsgicgi.py    
    @@ -77,5 +77,7 @@
         try:
             for chunk in content:
                 write(chunk)
    +        if not headers_sent:
    +            write('')
         finally:
             getattr(content, 'close', lambda : None)()
    

    and everything works like a champ. Thanks for your help. For now, you might want to put a note somewhere about the incompatibility with 2.5.0, and suggest this workaround.

  4. DRayX reporter

    Also wanted to point out that not all transactions actually work in this state. Certain users reported being unable to create new clones or push changes. I suspect that different versions of Mercurial acting as clients handle this error differently. However, it is safe to say that the repository is unusable in this state.

  5. Log in to comment