Bug 1118341

Summary: "number of transferred bytes cannot be negative" by aether-connector-file
Product: [Retired] JBoss BPMS Platform 6 Reporter: Toshiya Kobayashi <tkobayas>
Component: Business CentralAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Lukáš Petrovický <lpetrovi>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.2CC: alazarot, kverlaen, manstis, mfusco, mwinkler
Target Milestone: ER5   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:08:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
jBPM6Ex18_mvn_number_of_transferred_reproducer.zip
none
settings.xml
none
BZ1118341.patch none

Description Toshiya Kobayashi 2014-07-10 13:14:25 UTC
Description of problem:

aether-connector-file throws "number of transferred bytes cannot be negative" Exception just for artifact existence check.

17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) Exception in thread "FileRepositoryConnector-1" java.lang.IllegalArgumentException: number of transferred bytes cannot be negative
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) 	at org.sonatype.aether.util.listener.DefaultTransferEvent.setTransferredBytes(DefaultTransferEvent.java:123)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) 	at org.sonatype.aether.connector.file.FileRepositoryWorker.run(FileRepositoryWorker.java:299)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) 	at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
17:53:38,745 ERROR [stderr] (FileRepositoryConnector-1) 	at java.lang.Thread.run(Thread.java:744)


Steps to Reproduce:

# This is one artificial procedure to reproduce the issue in BPMS 6.0.2. The bug exists in lower layer (aether-connector-file) so I think there are several scenarios to trigger this issue. BZ1084362 was one scenario in BPMS 6.0.1. 

1. Create a maven kjar project which has <dependencyManagement> which loads an artifact from http://maven.repository.redhat.com/techpreview/all (Attached jBPM6Ex18_mvn_number_of_transferred_reproducer.zip)
2. Add http://maven.repository.redhat.com/techpreview/all as a repository in ~/.m2/settings.xml (Attached settings.xml)
3. mvn clean install
4. Comment-out the repository (http://maven.repository.redhat.com/techpreview/all) in ~/.m2/settings.xml
5. Start BPMS
6. Deploy the kjar via [New Deployment Unit] (e.g. groupId=com.sample, artifactId=jbpm-example, version=1.0.0-SNAPSHOT)

Actual results:

Throws 

java.lang.IllegalArgumentException: number of transferred bytes cannot be negative

and fails to deploy the kjar.

Expected results:

Successfully deploy the kjar. (Because the artifact "org.jboss.ip.component.management:ip-dependency-management-all:1.2-redhat-13" actually exists in local repo)

Additional info:

BZ1018220 also talks about this problem and has been fixed. But this BZ is filed for fixing the root problem.

Comment 1 Toshiya Kobayashi 2014-07-10 13:15:47 UTC
Created attachment 917072 [details]
jBPM6Ex18_mvn_number_of_transferred_reproducer.zip

Comment 2 Toshiya Kobayashi 2014-07-10 13:16:37 UTC
Created attachment 917073 [details]
settings.xml

Comment 3 Toshiya Kobayashi 2014-07-10 13:18:53 UTC
Created attachment 917075 [details]
BZ1118341.patch

Comment 4 Toshiya Kobayashi 2014-07-10 13:29:48 UTC
I have attached a patch to fix this issue for aether-connector-file. You can see why FileRepositoryWorker was causing the "number of transferred bytes cannot be negative".

A big problem is that sonatype-aether (https://github.com/sonatype/sonatype-aether) has been moved to eclipse-aether (http://git.eclipse.org/c/aether/) and the codebase was almost re-written. So I think there is no place to report/fix this issue for sonatype-aether 13.x / 14 version. If droolsjbpm team will maintain sonatype-aether, this patch would help.

Comment 5 Marek Winkler 2014-07-10 13:38:29 UTC
As far as I know, Mario planned to fix this issue by upgrading to eclipse aether and Maven 3.1.1. Is this correct?

A workaround could be to clear the local maven repository (the exception is thrown when you have an artifact in your local maven repository and this artifact had been downloaded from different remote repository that you are now looking for (this should be the effect of commenting the repository in settings.xml)).

Comment 6 Mario Fusco 2014-07-10 17:50:03 UTC
What Marek wrote is correct. This issue should be resolved migrating kie-ci to eclipse.aether and there is no other possible workaround (except the one he is suggesting) before this migration will be finalized. Actually I pushed that migration on master yesterday, but today I had to revert that commit because we realized it caused an incompatibility problem in guvnor between sisu.guice (used by maven 3.1.x/3.2.x) and guice (used by errai). Michael Anstis is currently working to find a fix for this last problem.

Comment 9 Pavel Kralik 2015-03-03 16:10:49 UTC
BPMS 6.1.0.ER5