Bug 1251503 - Creation and group association of bundle fails with IllegalArgumentException: Token did not result in valid file when deploy.xml uses rhq handover
Summary: Creation and group association of bundle fails with IllegalArgumentException:...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Provisioning
Version: JON 3.3.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER01
: JON 3.3.4
Assignee: Michael Burman
QA Contact: Filip Brychta
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-07 14:24 UTC by dsteigne
Modified: 2019-08-15 05:04 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1233991
Environment:
Last Closed: 2015-10-28 14:37:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Test Bundle with handover (3.88 KB, application/zip)
2015-08-10 18:29 UTC, dsteigne
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1233991 0 unspecified CLOSED Creation and group association of bundle fails with IllegalArgumentException: Token did not result in valid file 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1252142 0 urgent CLOSED Creation and group association of bundle fails with timeout followed by IllegalArgumentException: Token did not result i... 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 1571233 0 None None None Never
Red Hat Product Errata RHSA-2015:1947 0 normal SHIPPED_LIVE Important: Red Hat JBoss Operations Network 3.3.4 update 2015-10-28 18:36:15 UTC

Internal Links: 1233991 1252142

Description dsteigne 2015-08-07 14:24:16 UTC
+++ This bug was initially created as a clone of Bug #1233991 +++

Description of problem:
A user with the _Create Bundle In Group_ permission is unable to create a bundle and associate it with a bundle group when the bundle archive file is larger then 30 MB. 

    ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:7080-6) JBAS014134: EJB Invocation failed on component BundleManagerBean for method public abstract org.rhq.core.domain.bundle.BundleVersion org.rhq.enterprise.server.bundle.BundleManagerLocal.createInitialBundleVersionViaToken(org.rhq.core.domain.auth.Subject,int[],java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: java.lang.IllegalArgumentException: Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:215) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:261) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        ...
        at org.rhq.enterprise.server.bundle.BundleManagerLocal$$$view80.createInitialBundleVersionViaToken(Unknown Source) [rhq-server.jar:4.12.0.JON330GA]
        at org.rhq.coregui.server.gwt.BundleGWTServiceImpl.createInitialBundleVersionViaToken(BundleGWTServiceImpl.java:117)
        ...
    Caused by: java.lang.IllegalArgumentException: Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp]
        at org.rhq.enterprise.server.bundle.BundleManagerBean.createInitialBundleVersionViaToken(BundleManagerBean.java:2671) [rhq-server.jar:4.12.0.JON330GA]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_75]
        ...

Version-Release number of selected component (if applicable):
3.3.1

How reproducible:
Always

Steps to Reproduce:
1.  Install, configure and start JBoss ON 3.3 system.
2.  Build a bundle archive that is at least 80 MB in size.

    ~~~
tmpDir="`mktemp -d`"

cat >"${tmpDir}"/deploy.xml <<EOF
<?xml version="1.0"?>
<project name="largeFile"
         default="main"
         xmlns:rhq="antlib:org.rhq.bundle">
  <target name="main" />

  <rhq:bundle name="Large File Test Bundle"
              version="1.0"
              description="A sample bundle consisting of a single large file">
    <rhq:deployment-unit name="files"
                         compliance="filesAndDirectories">
EOF

mkdir "${tmpDir}"/files
for file in {001..001}; do
    echo "This is File #${file}." > "${tmpDir}/files/file-${file}.txt"
    dd if=/dev/urandom of="${tmpDir}/files/file-${file}.bin" bs=8M count=10
    echo '      <rhq:file name="files/file-'"${file}"'.txt" destinationFile="files/file-'"${file}"'.txt" replace="true" />' >> "${tmpDir}"/deploy.xml
    echo '      <rhq:file name="files/file-'"${file}"'.bin" destinationFile="files/file-'"${file}"'.bin" replace="true" />' >> "${tmpDir}"/deploy.xml
done

cat >>"${tmpDir}"/deploy.xml <<EOF
    </rhq:deployment-unit>
  </rhq:bundle>
</project>
EOF
(cd "${tmpDir}" && zip -r /tmp/large-bundle.zip .)
rm -rf "${tmpDir}"
ls -al /tmp/large-bundle.zip
    ~~~
    
3.  Create a bundle group:

    *   *Name:* `Test01 - Bundle Group`

4.  Create a new user role:

    *   *Permissions:*
        *   *Name:* `Test01 - Bundle Deployer Role`
        *   *Resource Permissions:*
            *   *Inventory:* _Write_
            *   *Control:* _Write_
            *   *Create Child Resources:* _Write_
        *   *Bundle Permissions:*
            *   *Create Bundle In Group:* _Yes_
            *   *Delete Bundle From Group:* _Yes_
            *   *Deploy Bundle To Group:* _Yes_
    *   *Resource Groups:*
        *   *Assigned Resource Groups:* _DynaGroup - Groups by platform ( Linux )_
    *   *Bundle Groups:*
        *   *Assigned Resource Groups:* _Test01 - Bundle Deployer Role_

5.  Create a new user:

    *   *Username:* `TestUser01`
    *   *Password:* `TestUser01`
    *   *First Name:* `Test`
    *   *Last Name:* `User01`
    *   *Email Address:* `testuser01`
    *   *Assigned Roles:* _Test01 - Bundle Deployer Role_
    
6.  Sign-in as _TestUser01_.
7.  Create new bundle using _/tmp/large-bundle.zip_ and assign it to the _Test01 - Bundle Group_ bundle group.

Actual results:
Clicking _Next_ after adding _Test01 - Bundle Group_ to the assigned bundle group list results in a failure message being written at the bottom of the bundle creation dialog:

[1434759019246] javax.ejb.EJBException:java.lang.IllegalArgumentException: Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp] -> java.lang.IllegalArgumentException:Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp]

server.log also includes the error with a very long stack trace:

    INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/coregui]] (http-/0.0.0.0:7080-6) org.rhq.coregui.CoreGUI BundleDistributionFileUploadServlet: file was uploaded: large-bundle.zip
    ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:7080-6) JBAS014134: EJB Invocation failed on component BundleManagerBean for method public abstract org.rhq.core.domain.bundle.BundleVersion org.rhq.enterprise.server.bundle.BundleManagerLocal.createInitialBundleVersionViaToken(org.rhq.core.domain.auth.Subject,int[],java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: java.lang.IllegalArgumentException: Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:215) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:261) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
        ...
        at org.rhq.enterprise.server.bundle.BundleManagerLocal$$$view80.createInitialBundleVersionViaToken(Unknown Source) [rhq-server.jar:4.12.0.JON330GA]
        at org.rhq.coregui.server.gwt.BundleGWTServiceImpl.createInitialBundleVersionViaToken(BundleGWTServiceImpl.java:117)
        ...
    Caused by: java.lang.IllegalArgumentException: Token did not result in valid file [/tmp/upload__2700a40a_14e0df9cb34__8000_00000014.tmp]
        at org.rhq.enterprise.server.bundle.BundleManagerBean.createInitialBundleVersionViaToken(BundleManagerBean.java:2671) [rhq-server.jar:4.12.0.JON330GA]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_75]
        ...
Expected results:
The bundle should be successfully created and no error/warning is displayed or logged in server.log.

Additional info:
If the file is smaller, this error does not occur. This would lead me to believe that the issue has something to do with streaming the file/contents or some type of time interval that results in the temporary file being deleted.

Also, this seems to be permission related. For example, rhqadmin is able to perform the exact same steps without any error. 

TestUser01 is also able to successfully create the bundle if the bundle is created using the recipe file instead of uploading the archive. In other words, instead of using the "upload" option on the first page of the bundle wizard you select "Recipe" and upload the deploy.xml, all works fine.

--- Additional comment from Larry O'Leary on 2015-06-19 20:55:38 EDT ---

Actually, this does not seem to have anything to do with file size. Even a 15K bundle archive fails in the same manner.

--- Additional comment from Michael Burman on 2015-07-13 07:28:35 EDT ---

It works as rhqadmin because the same method is not called - it would cause the same error in this case.

--- Additional comment from Michael Burman on 2015-07-13 09:12:18 EDT ---

Right, the issue is in createBundle(BundleManagerBean:256), where we check for the user rights and check if they have the right to create a bundle or create a bundle for the group.

However, selecting the group happens after the bundle has been uploaded.. so an empty list is sent to the method and it fails. I'll need to ask around a bit what has been the intention of this - I doubt this has ever worked.

--- Additional comment from Michael Burman on 2015-07-14 04:44:41 EDT ---

Fixed in the master:

commit d7d9c5b6f971b7d495a94ba9fbf1b2905a3c60ac
Author: Michael Burman <miburman>
Date:   Tue Jul 14 11:44:00 2015 +0300

    [BZ 1233991] Fix the viaToken method by fetching the file from correct temp-directory

--- Additional comment from Simeon Pinder on 2015-07-20 10:19:19 EDT ---

branch: release/jon3.3.x
commit 6c0daf9a93937880be29fc3ba29fc3f526828829
Author:     Michael Burman <miburman>
AuthorDate: Tue Jul 14 11:44:00 2015 +0300
Commit:     Simeon Pinder <spinder>
CommitDate: Mon Jul 20 10:14:07 2015 -0400

    [BZ 1233991] Fix the viaToken method by fetching the file from correct temp-director

--- Additional comment from Simeon Pinder on 2015-07-24 02:19:54 EDT ---

Available for test with following build:
 https://brewweb.devel.redhat.com/buildinfo?buildID=448923
   *Note: jon-server-patch-3.3.0.GA.zip maps to CR01 build of
   jon-server-3.3.0.GA-update-03.zip.

--- Additional comment from Sunil Kondkar on 2015-07-27 11:27:39 EDT ---

Verified on Version :3.3.0.GA Update 03 Build Number :	edc324f:119e8f4

Followed the steps and verified that the bundle is created successfully by user 'TestUser01' without any error in UI or server.log.

Please refer the attached screenshots.

--- Additional comment from Sunil Kondkar on 2015-07-27 11:29:07 EDT ---



--- Additional comment from Sunil Kondkar on 2015-07-27 11:29:49 EDT ---



--- Additional comment from errata-xmlrpc on 2015-07-30 11:49:05 EDT ---

Bug report changed to RELEASE_PENDING status by Errata System.
Advisory RHSA-2015:21279-07 has been changed to PUSH_READY status.
https://errata.devel.redhat.com/advisory/21279

--- Additional comment from errata-xmlrpc on 2015-07-30 12:43:42 EDT ---

Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1525.html

Comment 1 dsteigne 2015-08-07 14:26:03 UTC
Tested and this issue was not fixed in the 3.3.3 release

Comment 2 dsteigne 2015-08-10 18:28:19 UTC
After testing further it doesn't matter what size the bundle is, if the deploy.xml is using  rhq:handover it will fail when you click next and return the error[1], Attaching test MQTest.zip to bug.

Recipe file:
<?xml version="1.0"?>
<project name="MQTest" default="main" xmlns:rhq="antlib:org.rhq.bundle">
	<rhq:bundle name="MQ Test Test" version="1.0" description="A simple MQ application.">
	 
		<rhq:deployment-unit name="appserver" manageRootDir="false">
				
			<rhq:archive name="MQTest.war">
				<rhq:handover action="deployment" />
			</rhq:archive>
			
		</rhq:deployment-unit>
    </rhq:bundle>
	
	<target name="main" />
	
</project>


[1]
11:13:28,783 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:7080-3) JBAS014134: EJB Invocation failed on component BundleManagerBean for method public abstract org.rhq.core.domain.bundle.BundleVersion org.rhq.enterprise.server.bundle.BundleManagerLocal.createInitialBundleVersionViaToken(org.rhq.core.domain.auth.Subject,int[],java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: java.lang.IllegalArgumentException: Token did not result in valid file [/NotBackedUp/dsteigne/jon3.3.0/jon-server-3.3.0.GA/jbossas/standalone/tmp/MQTest.zip3665601388344817469.tmp]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:215) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:261) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.never(CMTTxInterceptor.java:309) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:234) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.4.3.Final-redhat-2.jar:7.4.3.Final-redhat-2]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.4.3.Final-redhat

Comment 3 dsteigne 2015-08-10 18:29:08 UTC
Created attachment 1061187 [details]
Test Bundle with handover

Comment 7 Michael Burman 2015-09-08 08:03:57 UTC
Fixed in the master:

commit f593a67bfefb83aa9ca2a2cc9c0019b7b99717bd
Author: Michael Burman <miburman>
Date:   Tue Sep 8 11:03:26 2015 +0300

    [BZ 1251503] Change FileUploadServlet to use JBossServerTempDir

Comment 8 Libor Zoubek 2015-09-25 08:25:27 UTC
branch:  release/jon3.3.x
link:    https://github.com/rhq-project/rhq/commit/6849cceb9
time:    2015-09-25 10:19:23 +0200
commit:  6849cceb94b4d7d6c2a668c9089dc7661731346f
author:  Michael Burman - miburman
message: [BZ 1251503] Change FileUploadServlet to use JBossServerTempDir

         (cherry picked from commit
         f593a67bfefb83aa9ca2a2cc9c0019b7b99717bd) Signed-off-by: Libor
         Zoubek <lzoubek>

Comment 9 Simeon Pinder 2015-10-09 04:40:13 UTC
Moving to ON_QA as available to test with the following build:
https://brewweb.devel.redhat.com/buildinfo?buildID=460382

 *Note: jon-server-patch-3.3.0.GA.zip maps to ER01 build of
 jon-server-3.3.0.GA-update-04.zip.

Comment 10 Filip Brychta 2015-10-09 10:49:38 UTC
Verified on
Version :	
3.3.0.GA Update 04
Build Number :	
821a526:fa7b1a1

Comment 12 errata-xmlrpc 2015-10-28 14:37:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1947.html


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