Shell script to stop and start the services of gerrit

573 views
Skip to first unread message

kamal gumparthi

unread,
Jul 18, 2017, 6:55:53 AM7/18/17
to Repo and Gerrit Discussion
Hi,


Could you please provide the shell script which need to call ./gerrit.sh stop and ./gerrit.start  gerrit services. We dont want ./gerrit.sh restart since it is causing problem now a days.

Requirements:
1.First it should stop the services.
2.Check if the services stopped or not
3.If stopped then do start  after 5 minutes else do first point again else quit.
4.If start is working then check the status of the process.

Dave Borowitz

unread,
Jul 18, 2017, 10:57:21 AM7/18/17
to kamal gumparthi, Repo and Gerrit Discussion
The script you want is gerrit.sh. Can you clarify, what kind of problems is it causing you? If there is a bug in it, it would be better to fix it for everybody than to write a new script.

--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kamal gumparthi

unread,
Jul 19, 2017, 2:05:27 AM7/19/17
to Repo and Gerrit Discussion, shar...@gmail.com
Hi Dave,

Thanks for the reply.

We have an issue at the time of gerrit restart in crontab.This was working since many days but recent days it is not working. So decided to create one script to call ./gerritsh stop and start instead of ./gerrit.sh restart.
Posted this issue earlier. Please see the below link.

Also one more thing today we have got other error while crotnab schedule ran. Manual stop and start is working fine.


[2017-07-19 06:00:35,310] WARN  com.google.gerrit.server.cache.h2.H2CacheImpl : Cannot build BloomFilter for jdbc:h2:file:/opt/gerrit/cache/conflicts: Database may be already in use: "Locked by another process". Possible solutions: close all other connection(s); use the server mode [90020-174]

[2017-07-19 06:00:36,301] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon

com.google.inject.ProvisionException: Unable to provision, see the following errors:

 

1) Error injecting constructor, org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/opt/gerrit/index/changes_0014/open/write.lock

  at com.google.gerrit.lucene.LuceneChangeIndex.<init>(LuceneChangeIndex.java:241)

  while locating com.google.gerrit.lucene.LuceneChangeIndex annotated with @com.google.inject.internal.UniqueAnnotations$Internal(value=9)

 

1 error

        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)

        at com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:770)

        at com.google.gerrit.lucene.$Proxy104.create(Unknown Source)

        at com.google.gerrit.lucene.LuceneVersionManager.start(LuceneVersionManager.java:150)

        at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)

        at com.google.gerrit.pgm.Daemon.start(Daemon.java:293)

        at com.google.gerrit.pgm.Daemon.run(Daemon.java:205)

        at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)

        at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)

        at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)

        at Main.main(Main.java:25)

Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/opt/gerrit/index/changes_0014/open/write.lock

        at org.apache.lucene.store.Lock.obtain(Lock.java:89)

        at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:753)

        at com.google.gerrit.lucene.AutoCommitWriter.<init>(AutoCommitWriter.java:34)

        at com.google.gerrit.lucene.SubIndex.<init>(SubIndex.java:75)

        at com.google.gerrit.lucene.SubIndex.<init>(SubIndex.java:60)

        at com.google.gerrit.lucene.LuceneChangeIndex.<init>(LuceneChangeIndex.java:274)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

        at com.google.inject.internal.DefaultConstructionProxyFactory$2.newInstance(DefaultConstructionProxyFactory.java:86)

        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105)

        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)

        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)

        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)

        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)






 
 

kamal gumparthi

unread,
Jul 19, 2017, 7:44:37 AM7/19/17
to Repo and Gerrit Discussion, shar...@gmail.com
Manual Stop and start is also not working from today onwards. Same error showing in the error_log file.

Currently we are not able to restart/stop/start the gerrit services.

Björn Pedersen

unread,
Jul 19, 2017, 8:50:06 AM7/19/17
to Repo and Gerrit Discussion, shar...@gmail.com
Hi,

possible reasons:
 unclean shutdown (due to powerloss etc.. ) - > remove the lock file manually
 another gerrit process still running and  pid-file lost/wrong ( check with ps...)



A of course mentioning  the gerrit version would help.
Is there any error logged in logs/error_log?

Björn

kamal gumparthi

unread,
Jul 20, 2017, 2:26:28 AM7/20/17
to Repo and Gerrit Discussion, shar...@gmail.com
Hi Pederson,

Please find the attached document.
I have explained the issue with screenshots and included error_log as well.
Please let me know which lock file do you want me to remove? changes_0014/open/write.lock file?

STOP_START.docx

diptim...@appdynamics.com

unread,
Jul 25, 2017, 4:01:00 AM7/25/17
to Repo and Gerrit Discussion, shar...@gmail.com
Can you run a git gc and gerrit gc to see if there are some corrupted objects found. If something found the gc log please rectify the issues and run the steps manually. We do have some script to start gerrit service and stop it. Never face any issues with that.
Reply all
Reply to author
Forward
0 new messages