索引时,它会尝试为perforce repo创建历史记录缓存,并失败并显示以下NULL ptr异常:
2015-01-16 10:30:32.178-0800 INFO t1 HistoryGuru.createCacheReal: Creating historycache for 1 repositories
2015-01-16 10:30:32.179-0800 INFO t22 HistoryGuru.createCache: Creating historycache for /local2/mnt/workspace/opengrok/src (PerforceRepository)
2015-01-16 10:30:32.181-0800 FINE t22 Executor.exec: Executing command [/pkg/qct/software/p4/p4, dirs, *] in directory /local2/mnt/workspace/opengrok/src
2015-01-16 10:30:32.458-0800 FINE t22 Executor.exec: Finished command [/pkg/qct/software/p4/p4, dirs, *] in directory /local2/mnt/workspace/opengrok/src
2015-01-16 10:30:32.459-0800 FINE t22 Executor.exec: Executing command [p4, changes, -t, ...] in directory /local2/mnt/workspace/opengrok/src
2015-01-16 10:30:39.230-0800 FINE t22 Executor.exec: Finished command [p4, changes, -t, ...] in directory /local2/mnt/workspace/opengrok/src
2015-01-16 10:30:39.366-0800 FINE t22 FileHistoryCache.store: Storing history for repo /local2/mnt/workspace/opengrok/src
2015-01-16 10:30:39.369-0800 WARNING t22 FileHistoryCache.storeLatestCachedRevision: cannot write latest cached revision to file: null
2015-01-16 10:30:39.369-0800 WARNING t22 HistoryGuru.createCache: An error occured while creating cache for /local2/mnt/workspace/opengrok/src (PerforceRepository)
java.lang.NullPointerException
at org.opensolaris.opengrok.history.FileHistoryCache.storeLatestCachedRevision(FileHistoryCache.java:595
我已经检查过用户对$ OPENGROK_INSTANCE_BASE / data的写权限。还有什么想法可以检查或者可能会发生什么?
OpenGrok版本:0.12.1.1 索引cmd:
OPENGROK_TAG=1 OPENGROK_VERBOSE=1 OPENGROK_REMOTE_REPOS_OFF=0 OPENGROK_TOMCAT_CASE=/usr/share/tomcat7 OPENGROK_INSTANCE_BASE=/local2/mnt/workspace/opengrok ./OpenGrok index /local2/mnt/workspace/opengrok/src/
答案 0 :(得分:0)
原来这是OpenGrok中的一个错误。见线程:https://github.com/OpenGrok/OpenGrok/issues/878
简而言之,src / org / opensolaris / opengrok / history / FileHistoryCache.java需要进行NULL ptr检查。
@@ -592,7 +592,9 @@ private void storeLatestCachedRevision(Repository repository, String rev) {
ex.getCause());
} finally {
try {
- writer.close();
+ if (writer != null) {
+ writer.close();
+ }
} catch (IOException ex) {
logger.log(Level.INFO, "cannot close file: " + ex);
}
https://github.com/OpenGrok/OpenGrok/commit/0dbb0e366b3798ac18d1bfc010a1985bce75f071
为什么文件编写器首先是NULL是另一个问题...