New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when viewing project in web UI when git.cacheRepositoryList = false #478

Closed
gitblit opened this Issue Aug 12, 2015 · 11 comments

Comments

Projects
None yet
2 participants
@gitblit
Owner

gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 182

We've just upgraded our GitBlit v1.1.0 install to v1.2.0, and loading a project page
triggers an NPE unless web.allowForking is set to false.

User authentication is done via LDAP, and the logged-in user is a member of the group
with the "Can fork authorized repositories" setting enabled.

Stack trace:
java.lang.NullPointerException
        at com.gitblit.GitBlit.getFork(GitBlit.java:1740)
        at com.gitblit.wicket.pages.RepositoryPage.setupPage(RepositoryPage.java:266)
        at com.gitblit.wicket.pages.RepositoryPage.onBeforeRender(RepositoryPage.java:522)
        at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
        at org.apache.wicket.Component.beforeRender(Component.java:1103)
        at org.apache.wicket.Component.prepareForRender(Component.java:2297)
        at org.apache.wicket.Page.prepareForRender(Page.java:1545)
        at org.apache.wicket.Component.prepareForRender(Component.java:2329)
        at org.apache.wicket.Page.renderPage(Page.java:912)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1287)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
        at java.lang.Thread.run(Thread.java:736)

Reported by brant@control-v.net on 2013-01-02 20:21:13

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Your problem is unrelated to the web.allowForking setting.
You need to enable repo caching.

git.cacheRepositoryList = true

Reported by James.Moger on 2013-01-02 21:01:53

Owner

gitblit commented Aug 12, 2015

Your problem is unrelated to the web.allowForking setting.
You need to enable repo caching.

git.cacheRepositoryList = true

Reported by James.Moger on 2013-01-02 21:01:53

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner

Reported by James.Moger on 2013-01-02 21:04:06

Owner

gitblit commented Aug 12, 2015

Reported by James.Moger on 2013-01-02 21:04:06

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
To be fair, it is related to but not caused by web.allowForking.

There appear to be a handful of bugs related to tracking fork state and not caching
the repository list.  The reason to cache the repo list is to avoid abusing the disk
to determine information which is static.  The argument against caching is creating/removing
repos from outside Gitblit.  If you plan to use Gitblit as a server then I recommend
using it's caching mechanism.  If you plan to use Gitblit as a viewer then it may make
sense to disable caching but you should also consider disabling it's server features
like forking.

Reported by James.Moger on 2013-01-02 21:18:31

  • Status changed: Accepted
  • Labels added: Milestone-1.2.1
Owner

gitblit commented Aug 12, 2015

To be fair, it is related to but not caused by web.allowForking.

There appear to be a handful of bugs related to tracking fork state and not caching
the repository list.  The reason to cache the repo list is to avoid abusing the disk
to determine information which is static.  The argument against caching is creating/removing
repos from outside Gitblit.  If you plan to use Gitblit as a server then I recommend
using it's caching mechanism.  If you plan to use Gitblit as a viewer then it may make
sense to disable caching but you should also consider disabling it's server features
like forking.

Reported by James.Moger on 2013-01-02 21:18:31

  • Status changed: Accepted
  • Labels added: Milestone-1.2.1
@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
I pushed a change for your NPE and also pushed another change for a related NPE.  Another
drawback of not using the repository cache is not having the fork network feature.
 Fork network (tree/graph) is demonstrated here:

https://demo-gitblit.rhcloud.com/forks/gitblit.git

While you could generate the fork network per-request without the cache it would be
expensive/abusive for the disk to cycle through all your repos to determine the graph.
 Now multiply that by my (known) worst-case user with ~7k repos.  :(

Reported by James.Moger on 2013-01-02 21:41:37

  • Status changed: Queued
Owner

gitblit commented Aug 12, 2015

I pushed a change for your NPE and also pushed another change for a related NPE.  Another
drawback of not using the repository cache is not having the fork network feature.
 Fork network (tree/graph) is demonstrated here:

https://demo-gitblit.rhcloud.com/forks/gitblit.git

While you could generate the fork network per-request without the cache it would be
expensive/abusive for the disk to cycle through all your repos to determine the graph.
 Now multiply that by my (known) worst-case user with ~7k repos.  :(

Reported by James.Moger on 2013-01-02 21:41:37

  • Status changed: Queued
@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Thanks for the prompt response and the advice!

Reported by brant@control-v.net on 2013-01-03 15:44:25

Owner

gitblit commented Aug 12, 2015

Thanks for the prompt response and the advice!

Reported by brant@control-v.net on 2013-01-03 15:44:25

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Fixes deployed in 1.2.1

Reported by James.Moger on 2013-01-16 04:25:08

Owner

gitblit commented Aug 12, 2015

Fixes deployed in 1.2.1

Reported by James.Moger on 2013-01-16 04:25:08

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner

Reported by James.Moger on 2013-01-16 04:25:29

  • Status changed: Fixed
Owner

gitblit commented Aug 12, 2015

Reported by James.Moger on 2013-01-16 04:25:29

  • Status changed: Fixed
@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Hi 

This still appears to be an issue in Gitblit Go 1.2.1 (it can be worked around by setting
git.cacheRepositoryList = true).

We get an error page in the GUI when clicking on a repository with the following options
set:
web.allowForking = true
git.cacheRepositoryList = false

Stack trace:
java.lang.NullPointerException
        at com.gitblit.GitBlit.getFork(GitBlit.java:1830)
        at com.gitblit.wicket.pages.RepositoryPage.setupPage(RepositoryPage.java:274)
        at com.gitblit.wicket.pages.RepositoryPage.onBeforeRender(RepositoryPage.java:526)
        at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
        at org.apache.wicket.Component.beforeRender(Component.java:1103)
        at org.apache.wicket.Component.prepareForRender(Component.java:2297)
        at org.apache.wicket.Page.prepareForRender(Page.java:1545)
        at org.apache.wicket.Component.prepareForRender(Component.java:2329)
        at org.apache.wicket.Page.renderPage(Page.java:912)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1287)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:363)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:920)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:982)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:662)

Reported by markndavison on 2013-01-22 13:02:30

Owner

gitblit commented Aug 12, 2015

Hi 

This still appears to be an issue in Gitblit Go 1.2.1 (it can be worked around by setting
git.cacheRepositoryList = true).

We get an error page in the GUI when clicking on a repository with the following options
set:
web.allowForking = true
git.cacheRepositoryList = false

Stack trace:
java.lang.NullPointerException
        at com.gitblit.GitBlit.getFork(GitBlit.java:1830)
        at com.gitblit.wicket.pages.RepositoryPage.setupPage(RepositoryPage.java:274)
        at com.gitblit.wicket.pages.RepositoryPage.onBeforeRender(RepositoryPage.java:526)
        at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
        at org.apache.wicket.Component.beforeRender(Component.java:1103)
        at org.apache.wicket.Component.prepareForRender(Component.java:2297)
        at org.apache.wicket.Page.prepareForRender(Page.java:1545)
        at org.apache.wicket.Component.prepareForRender(Component.java:2329)
        at org.apache.wicket.Page.renderPage(Page.java:912)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1287)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1358)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1465)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1300)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:445)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:556)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:363)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:920)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:982)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:662)

Reported by markndavison on 2013-01-22 13:02:30

@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner

Reported by James.Moger on 2013-01-22 13:14:46

  • Status changed: Accepted
  • Labels added: Milestone-1.3.0
  • Labels removed: Milestone-1.2.1
Owner

gitblit commented Aug 12, 2015

Reported by James.Moger on 2013-01-22 13:14:46

  • Status changed: Accepted
  • Labels added: Milestone-1.3.0
  • Labels removed: Milestone-1.2.1
@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Fixed on master.
Thanks for the report!

Reported by James.Moger on 2013-03-28 21:36:34

  • Status changed: Queued
Owner

gitblit commented Aug 12, 2015

Fixed on master.
Thanks for the report!

Reported by James.Moger on 2013-03-28 21:36:34

  • Status changed: Queued
@gitblit

This comment has been minimized.

Show comment
Hide comment
@gitblit

gitblit Aug 12, 2015

Owner
Fix or enhancement released in v1.3.0

Reported by James.Moger on 2013-07-14 16:52:58

  • Status changed: Fixed
Owner

gitblit commented Aug 12, 2015

Fix or enhancement released in v1.3.0

Reported by James.Moger on 2013-07-14 16:52:58

  • Status changed: Fixed

@gitblit gitblit closed this Aug 12, 2015

@fzs fzs modified the milestone: 1.3.0 Dec 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment