Bug 575367 - Unable to finish git clone when shutting down gracefully
Summary: Unable to finish git clone when shutting down gracefully
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 5.13   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 5.13   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-11 20:33 EDT by Youngeun Kim CLA
Modified: 2021-08-29 05:55 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Youngeun Kim CLA 2021-08-11 20:33:14 EDT
Unable to finish git clone when shutting down gracefully

I am implementing a graceful shutdown.
The purpose is for all the tasks those were initiated before a SIGTERM to finish successfully before my application fully stops.

However IllegalStateException occurs if a SIGTERM was called during a org.eclipse.jgit.api.CloneCommand.call()

-------------
java.lang.IllegalStateException: Shutdown in progress 
  at java.base/java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82) 
  at java.base/java.lang.Runtime.removeShutdownHook(Runtime.java:241) 
  at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:200)  
-------------

I found out that cleanupHook was added to the code on 5/13 2017 by this commit which is causing this failure.
https://git.eclipse.org/c/jgit/jgit.git/commit/?id=9f98d3e2e4af009e1a5bad7e40969b241d45468b
 

An exception handling is needed here. Git clone fails without any reason to.
Comment 1 Eclipse Genie CLA 2021-08-12 03:29:05 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/183925