Bug 1118341 - "number of transferred bytes cannot be negative" by aether-connector-file
Summary: "number of transferred bytes cannot be negative" by aether-connector-file
Alias: None
Product: JBoss BPMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.0.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: ER5
: 6.1.0
Assignee: Mario Fusco
QA Contact: Lukáš Petrovický
Depends On:
TreeView+ depends on / blocked
Reported: 2014-07-10 13:14 UTC by Toshiya Kobayashi
Modified: 2018-12-06 17:16 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed:
Type: Bug

Attachments (Terms of Use)
jBPM6Ex18_mvn_number_of_transferred_reproducer.zip (28.92 KB, application/zip)
2014-07-10 13:15 UTC, Toshiya Kobayashi
no flags Details
settings.xml (3.17 KB, text/xml)
2014-07-10 13:16 UTC, Toshiya Kobayashi
no flags Details
BZ1118341.patch (2.09 KB, patch)
2014-07-10 13:18 UTC, Toshiya Kobayashi
no flags Details | Diff

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:


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]

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

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

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

Note You need to log in before you can comment on or make changes to this bug.