Skip to content

"Index database(s) not found." should not be 200 OK #17

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

Closed
cnst opened this issue Mar 18, 2013 · 2 comments · Fixed by #1347
Closed

"Index database(s) not found." should not be 200 OK #17

cnst opened this issue Mar 18, 2013 · 2 comments · Fixed by #1347
Labels

Comments

@cnst
Copy link

cnst commented Mar 18, 2013

When the index database is temporarily gone, OpenGrok returns "Index database(s) not found." (https://github.com/OpenGrok/OpenGrok/blob/master/src/org/opensolaris/opengrok/web/SearchHelper.java) with a 200 OK HTTP status code.

This breaks down HTTP accelerators (and probably various web-crawlers, too), which cache error pages momentarily (seconds), but non-error pages for an extended period of time (minutes or hours), where such OpenGrok error pages will be cached extensively, instead of being expired promptly. Plus web-crawlers might update its index, instead of ignoring the result, and trying back later.

With "Index database(s) not found.", a non-200 http status code should be returned instead, probably 503 Service Unavailable.

@vladak
Copy link
Member

vladak commented Dec 27, 2013

In web/search.jsp after prepareExec has been called we can either redirect to prepared 503 error page or set the error code based on the searchHelper.errorMsg contents somehow (I am not a JSP expert to tell which one is possible/feasible).

@vladak
Copy link
Member

vladak commented Jan 26, 2017

Since #1132 it is no longer easy to trigger this problem since index references are now cached so moving index directory away will not break the search because the file remains open. To reproduce this, one has to go and move the index directory away and then redeploy. Bunch of null pointer exceptions happen then :-)

Also, the error code should be set in error.jsp.

@vladak vladak self-assigned this Jan 26, 2017
vladak added a commit to vladak/OpenGrok that referenced this issue Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants