[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-12-13 Thread JIRA


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16720988#comment-16720988
 ] 

Jean-Baptiste Onofré commented on KARAF-5854:
-

If the exception is uncatched, I don't see an obvious way to handle this.

> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.1.8, 4.2.3
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:915)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:900)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-26 Thread JIRA


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16699653#comment-16699653
 ] 

Lars Ollén commented on KARAF-5854:
---

Thanks for the attention.

I do however believe this fix isn't enough to get the KAR installation stable, 
a couple of methods called will quite rudely just log and not re-throw 
exceptions.

What I can see it is the following:
addToFeaturesRepositories
installFeatures

 

> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-22 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695901#comment-16695901
 ] 

ASF subversion and git services commented on KARAF-5854:


Commit 5c4f1f7c7ab7b01f4281d99134ebe80abb51f37c in karaf's branch 
refs/heads/master from [~j...@nanthrax.net]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=5c4f1f7 ]

Merge pull request #656 from jbonofre/KARAF-5854

[KARAF-5854] Delete kar folder when exception occurs during installation

> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-22 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695906#comment-16695906
 ] 

ASF subversion and git services commented on KARAF-5854:


Commit 6ff26c44fa3fd6ec1a82d7181c2c1486937ae5f8 in karaf's branch 
refs/heads/karaf-4.1.x from [~j...@nanthrax.net]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=6ff26c4 ]

[KARAF-5854] Delete kar folder when exception occurs during installation


> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-22 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695898#comment-16695898
 ] 

ASF GitHub Bot commented on KARAF-5854:
---

jbonofre closed pull request #656: [KARAF-5854] Delete kar folder when 
exception occurs during installation
URL: https://github.com/apache/karaf/pull/656
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java 
b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
index 8ed5ff813a..b0c1d8db83 100644
--- a/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
+++ b/kar/src/main/java/org/apache/karaf/kar/internal/KarServiceImpl.java
@@ -102,8 +102,8 @@ public void install(URI karUri, File repoDir, File 
resourceDir) throws Exception
 @Override
 public void install(URI karUri, File repoDir, File resourceDir, boolean 
noAutoStartBundles) throws Exception {
 busy.set(true);
+Kar kar = new Kar(karUri);
 try {
-Kar kar = new Kar(karUri);
 kar.extract(repoDir, resourceDir);
 writeToFile(kar.getFeatureRepos(), new File(repoDir, 
FEATURE_CONFIG_FILE));
 for (URI uri : kar.getFeatureRepos()) {
@@ -141,6 +141,11 @@ public void install(URI karUri, File repoDir, File 
resourceDir, boolean noAutoSt
 }
 delayedDeployerThread = null;
 }
+} catch (Exception e) {
+// cleanup state if exception occurs during installation
+deleteRecursively(new File(storage, kar.getKarName()));
+// throw the exception to the "clients"
+throw e;
 } finally {
 busy.set(false);
 }


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-22 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695899#comment-16695899
 ] 

ASF subversion and git services commented on KARAF-5854:


Commit 1ff73ff27cf9a9a714749563a2d4d029c448052e in karaf's branch 
refs/heads/master from [~j...@nanthrax.net]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=1ff73ff ]

[KARAF-5854] Delete kar folder when exception occurs during installation


> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-22 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695900#comment-16695900
 ] 

ASF subversion and git services commented on KARAF-5854:


Commit 5c4f1f7c7ab7b01f4281d99134ebe80abb51f37c in karaf's branch 
refs/heads/master from [~j...@nanthrax.net]
[ https://gitbox.apache.org/repos/asf?p=karaf.git;h=5c4f1f7 ]

Merge pull request #656 from jbonofre/KARAF-5854

[KARAF-5854] Delete kar folder when exception occurs during installation

> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
>  Labels: kar
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:1022)
>  at 
> 

[jira] [Commented] (KARAF-5854) KAR file installation is not atomic

2018-11-21 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KARAF-5854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16695568#comment-16695568
 ] 

ASF GitHub Bot commented on KARAF-5854:
---

jbonofre opened a new pull request #656: [KARAF-5854] Delete kar folder when 
exception occurs during installation
URL: https://github.com/apache/karaf/pull/656
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> KAR file installation is not atomic
> ---
>
> Key: KARAF-5854
> URL: https://issues.apache.org/jira/browse/KARAF-5854
> Project: Karaf
>  Issue Type: Bug
>  Components: karaf
>Affects Versions: 4.1.4
>Reporter: Lars Ollén
>Assignee: Jean-Baptiste Onofré
>Priority: Major
> Fix For: 4.2.2, 4.1.7
>
>
> The KAR file installation process isn't atomic and handles exceptions poorly.
> If a shutdown signal is sent to Karaf while the KAR file is being installed 
> the KAR file can be unpacked to the data folder but the rest of the 
> installation steps will fail, leaving an uninstalled KAR file unpacked. That 
> will hinder the KAR file from being installed during the next startup of 
> Karaf (since Karaf checks only if the KAR file is unpacked and not if it was 
> installed).
> My initial though was that: 
> '_org.apache.karaf.kar.internal.KarServiceImpl#install(java.net.URI, 
> java.io.File, java.io.File, boolean)_' should rollback and delete the kar 
> folder in case the methods such as 
> 'org.apache.karaf.kar.internal.KarServiceImpl#addToFeaturesRepositories' gets 
> and exception, not sure how that would fit into the Karaf philosophy.
>  
> Below are the exceptions that we see (a bit redacted though):
> 2018-07-05T12:17:07.223+0200 | WARN | XX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to add repository 'mvn:/xml/features'
> java.lang.IllegalStateException: BundleContext is no longer valid
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:989)
>  at 
> org.eclipse.osgi.internal.framework.BundleContextImpl.getDataFile(BundleContextImpl.java:694)
>  at 
> org.apache.karaf.features.internal.osgi.Activator$1.getOutputStream(Activator.java:205)
>  at 
> org.apache.karaf.features.internal.service.StateStorage.save(StateStorage.java:56)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.saveState(FeaturesServiceImpl.java:360)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.addRepository(FeaturesServiceImpl.java:505)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.addToFeaturesRepositories(KarServiceImpl.java:266)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:111)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95)
>  at 
> org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:87)
>  at 
> org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:50)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:950)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:884)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:489)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>  at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> 2018-07-05T12:17:07.226+0200 | WARN | XXX | 
> o.a.karaf.kar.internal.KarServiceImpl | 51 - org.apache.karaf.kar.core - 
> 4.1.4 | Unable to install Kar feature X
> java.util.concurrent.RejectedExecutionException: Task 
> java.util.concurrent.FutureTask@5222a1f2 rejected from 
> java.util.concurrent.ThreadPoolExecutor@36cfb96[Terminated, pool size = 0, 
> active threads = 0, queued tasks = 0, completed tasks = 1]
>  at 
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063)
>  at 
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830)
>  at 
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1379)
>  at 
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
>  at 
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:681)
>  at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvisionInThread(FeaturesServiceImpl.java:1146)
>  at 
>