gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.28k stars 670 forks source link

Git LFS push fails with server exception #968

Closed paulsputer closed 8 years ago

paulsputer commented 8 years ago

Git LFS failed to push and returned server error. Gitblit logs show exception occurs:

2015-12-03 13:54:45 [WARN ] /git/r/qms/qms.git/info/lfs/objects/batch
java.lang.NullPointerException
        at com.gitblit.models.UserModel.canPush(UserModel.java:398)
        at com.gitblit.manager.FilestoreManager.addObject(FilestoreManager.java:152)
        at com.gitblit.manager.GitblitManager.addObject(GitblitManager.java:1258)
        at com.gitblit.servlet.FilestoreServlet.doPost(FilestoreServlet.java:124)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182)
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:294)
        at com.gitblit.servlet.AccessRestrictionFilter.doFilter(AccessRestrictionFilter.java:253)
        at com.gitblit.servlet.EnforceAuthenticationFilter.doFilter(EnforceAuthenticationFilter.java:99)
        at com.gitblit.servlet.ProxyFilter$1.doFilter(ProxyFilter.java:89)
        at com.gitblit.servlet.ProxyFilter.doFilter(ProxyFilter.java:92)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133)
        at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130)
        at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at org.eclipse.jetty.server.Server.handle(Server.java:499)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Unknown Source)
paulsputer commented 8 years ago

Currently investigating if this is caused by using a later version of Git-LFS (v1.1.0) or something else.

paulsputer commented 8 years ago

Not caused by later version of Git-LFS. LFS commands work fine on debug installation. Main difference is debug uses localAuth where as production uses LDAP auth. However, exception would imply that repositoryModel passed to userModel is null.

paulsputer commented 8 years ago

Production server runs via reverse proxy and reroutes URI traffic /git to gitblit. However the Regex to identify the repository is ^(.*?)/(r|git)/(.*?)/info/lfs/objects/(batch" and therefore assumes the r/ is part of the repository path.

@gitblit I used both r (Constants.R_PATH) and git (Constants.GIT_PATH) in the regex as I noticed WebModule.java serves on both. Searching the code though it looks as though the git path is a legacy value and all other places (FederationManager, ServicesManager,RpcServlet, TicketNotifier) use only r. Is this correct? Either it looks like I am safe to remove the git option from the regex so will push a PR to fix this.

gitblit commented 8 years ago

/git/ is a legacy path but an important one to preserve.

paulsputer commented 8 years ago

Thanks, merged in https://github.com/gitblit/gitblit/pull/969