Skip to content
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

An error occurred while reading history Failed to get history #1884

Closed
JustSong opened this issue Nov 20, 2017 · 15 comments
Closed

An error occurred while reading history Failed to get history #1884

JustSong opened this issue Nov 20, 2017 · 15 comments
Labels

Comments

@JustSong
Copy link

OpenGrok Version: opengrok-1.1-rc11
JDK: Oracle java version "1.8.0_144"
OS: Ubuntu 12.04.5 LTS
Tomcat: Tomcat8

The History Error occurred in all project. It showed the following message when I process index step:
An error occurred while reading history:
org.opensolaris.opengrok.history.HistoryException Failed to get history for: "" Exit code: 128

@vladak
Copy link
Member

vladak commented Nov 20, 2017

What kind of repository is being indexed ? If you bump the logging level in logging.properties then you should see what commands are being run. That will help you to replicate the same on command line.

@JustSong
Copy link
Author

Sorry, How can I bump my logging level in loggin.properties?

@vladak
Copy link
Member

vladak commented Nov 21, 2017

OpenGrok ships with logging.properties configuration file. Usually it is sufficient to change the level at the bottom of the file so it looks like this:

org.opensolaris.opengrok.level = ALL

@JustSong
Copy link
Author

JustSong commented Nov 22, 2017

I thinks it always be set the correct setting, but the error message didn't show more information.
org.opensolaris.opengrok.level = ALL

Error Message example:
08:52:32 WARNING: An error occurred while reading history: org.opensolaris.opengrok.history.HistoryException: Failed to get history for: "/opengrok/project/gcc/source/libcore/support/src/test/java/tests/resources/illegalClasses.jar" Exit code: 128 at org.opensolaris.opengrok.history.GitHistoryParser.parse(GitHistoryParser.java:165) at org.opensolaris.opengrok.history.GitRepository.getHistory(GitRepository.java:523) at org.opensolaris.opengrok.history.GitRepository.getHistory(GitRepository.java:516) at org.opensolaris.opengrok.history.FileHistoryCache.get(FileHistoryCache.java:553) at org.opensolaris.opengrok.history.HistoryGuru.getHistory(HistoryGuru.java:242) at org.opensolaris.opengrok.history.HistoryGuru.getHistory(HistoryGuru.java:202) at org.opensolaris.opengrok.history.HistoryGuru.getHistoryReader(HistoryGuru.java:186) at org.opensolaris.opengrok.analysis.AnalyzerGuru.populateDocument(AnalyzerGuru.java:343) at org.opensolaris.opengrok.index.IndexDatabase.addFile(IndexDatabase.java:667) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:949) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.indexDown(IndexDatabase.java:902) at org.opensolaris.opengrok.index.IndexDatabase.update(IndexDatabase.java:429) at org.opensolaris.opengrok.index.IndexDatabase$2.run(IndexDatabase.java:188) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

@JustSong
Copy link
Author

JustSong commented Nov 22, 2017

The Opengrok Website always show File Not Found , if I click the History button on any file.

default

@vladak
Copy link
Member

vladak commented Nov 22, 2017

The website errors are just manifestation of the problem happening in the indexer.

@vladak
Copy link
Member

vladak commented Nov 22, 2017

The WARNING line in the log is basically telling you that the git command failed for some reason. The key for understanding why is to get exactly the command that is being run. Luckily, the command is logged in full to the log so find the preceding line starting with Executing command ... in the log and try to run it exactly (under the same user, for instance) in the directory of the repository.

For example, in my case it says:

2017-11-22 13:55:54.253+0100 FINE t54 Executor.exec: Executing command [/usr/bin/git, log, --abbrev-commit, --abbrev=8, --name-only, --pretty=fuller, --date=iso8601-strict, f2cdc095..] in directory /var/opengrok/src/OpenGrok

so I will run /usr/bin/git log --abbrev-commit --abbrev=8 --name-only --pretty=fuller --date=iso8601-strict f2cdc095.. in the /var/opengrok/src/OpenGrok directory.

@vladak
Copy link
Member

vladak commented Nov 22, 2017

For example, if I break one of the options on purpose, I will get return code 128:

/var/opengrok/src/OpenGrok$ /usr/bin/git log --abbrev-commit --abbrev=8 --name-only --pretty=fuller --date=TOTALLY_INVALID_DATE_FORMAT
fatal: unknown date format TOTALLY_INVALID_DATE_FORMAT
/var/opengrok/src/OpenGrok$ echo $?
128

@vladak
Copy link
Member

vladak commented Nov 22, 2017

Another question is what version of Git are you running ?

@vladak
Copy link
Member

vladak commented Nov 22, 2017

Also, Executor (the class responsible for actually running external commands) logs the standard output of commands that exited with non-zero return code with WARNING level so you should be able to see the reason why the command failed right there in the indexer log.

@JustSong
Copy link
Author

Git version: 1.7.9.5

Yes, I found out the detail error message about git command fail.

10:41:44 WARNING: Non-zero exit status 128 from command [/usr/bin/git, log, --abbrev-commit, --abbrev=8, --name-only, --pretty=fuller, --date=iso8601-strict] in directory /opengrok/project/qt/source: fatal: unknown date format iso8601-strict

@JustSong
Copy link
Author

Hi vladak,

I updated the git version to newest and the history was shown.
Thanks a lot for your help.

@vladak
Copy link
Member

vladak commented Nov 23, 2017

Sometimes it is worth reading tjose logs ;-)

@naveen0256
Copy link

Hi, recently, my machine has been upgraded. I have my git as 2.16.2 version installed. Still I am getting the same error /usr/bin/git, log, --abbrev-commit, --abbrev=8, --name-only, --pretty=fuller, --date=iso8601-strict] in directory /opengrok/project/qt/source: fatal: unknown date format iso8601-strict. Do I need to update git to a newer version that that?

@tulinkry
Copy link
Contributor

And is /usr/bin/git your git 2.16? Because I'd guess it's not. Try running '/usr/bin/git --version` in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants