Bug 1375041 - [GSS](6.4.z) In OpenJDK 1.6 environment, EAP 6.4.x makes the vfs folder increased after restarting.
Summary: [GSS](6.4.z) In OpenJDK 1.6 environment, EAP 6.4.x makes the vfs folder incre...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: jbossas
Version: 6.4.0
Hardware: All
OS: All
unspecified
high
Target Milestone: CR1
: EAP 6.4.12
Assignee: Peter Palaga
QA Contact: Peter Mackay
URL:
Whiteboard: UpstreamNotAffected eap6412-proposed
Depends On:
Blocks: eap6412-payload 1397055
TreeView+ depends on / blocked
 
Reported: 2016-09-12 03:48 UTC by xuzhan
Modified: 2019-12-16 06:43 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
: 1397055 (view as bug list)
Environment:
Last Closed: 2017-01-17 13:14:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description xuzhan 2016-09-12 03:48:05 UTC
Description of problem:
When restart EAP 6.4.x under JDK 1.6 environment, a new folder named "deployment-to-be-deleted-xxxx" will be generated under  ${EAP_HOME}/standalone/tmp/vfs, stop EAP will not delete them.

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


How reproducible:


Steps to Reproduce:
1. install OpenJDK 1.6 then set JAVA_HOME correctly.
2. unzip "jboss-eap-6.4.0.zip" and start it as standalone mode(can patch it).
3. deploy .ear package to it, then restart EAP several times.
4. observe ${EAP_HOME}/standalone/tmp/vfs, new "deployment-to-be-deleted-xxxx" folder will be created.
5. stop EAP by "Ctrl+C", however, those folders will not be deleted.

Actual results:
A new "deployment-to-be-deleted-xxxx" will be created under %{EAP_HOME}/standalone/tmp/vfs

Expected results:
Only "temp" and "deployment" folders should be there

Additional info:
In JDK 1.7.x, such issue was gone, please let us know if anything wrong.

Comment 1 Peter Palaga 2016-09-15 16:00:49 UTC
I was able to reproduce this on Oracle Java 1.6.0_45.

I could trace the issue down to ScheduledThreadPoolExecutor not executing the DeleteTask submitted in [1].

Note that the executor is created using new ScheduledThreadPoolExecutor(0, threadFactory) in org.jboss.as.server.deployment.module.TempFileProviderService. 
Having seen several reports that ScheduledThreadPoolExecutor with corePoolSize=0 does not execute the tasks I tried ScheduledThreadPoolExecutor(1, threadFactory) and the issue stopped happening. I'll have to investigate further if this is a good solution also for newer Java versions.

[1] https://github.com/jbossas/jboss-vfs/blob/54cabe6f9001fbfe45d8a84b96f96cf215366e30/src/main/java/org/jboss/vfs/TempFileProvider.java#L97

Comment 2 Peter Palaga 2016-09-16 10:42:05 UTC
ScheduledThreadPoolExecutor with corePoolSize 0 does not schedule the tasks not only on early versions of Java 7 (as stated in https://bugs.openjdk.java.net/browse/JDK-7091003 ) but also on Java 1.6 which we see happening here. 

There is this case in JDK-7091003:

final ScheduledExecutorService ex = Executors.newScheduledThreadPool(0);
ex.schedule(new Runnable() {
    @Override
    public void run() {
        System.out.println("hello");
    }
}, 1, TimeUnit.SECONDS);

ex.shutdown();
ex.awaitTermination(5, TimeUnit.SECONDS);

JDK-7091003 states that the test passes on JDK 1.6.0_26-b03 correctly outputting "hello". While I can confirm the output, the following needs to be added: If we change the test as follows:

final ScheduledExecutorService ex = Executors.newScheduledThreadPool(0);
ex.schedule(new Runnable() {
    @Override
    public void run() {
        System.out.println("hello");
    }
}, 1, TimeUnit.SECONDS);

System.out.println("scheduled");
Thread.sleep(5000);
System.out.println("slept");

ex.shutdown();
ex.awaitTermination(5, TimeUnit.SECONDS);

then the output on Java 6 (e.g. 1.6.0_26 and 1.6.0_45) is 

scheduled
slept
hello

This is clearly not what we expect. We expect "hello" before "slept" as is indeed the case on newest versions of Java 7 and Java 8.

The modified test case shows, that on Java 6, the task execution is actually triggered by ScheduledExecutorService.shutdown(). 

Using ScheduledThreadPoolExecutor with corePoolSize 1 still seems to be a valid fix on Oracle/Sun Java 6.

Comment 3 Peter Palaga 2016-09-16 13:03:08 UTC
Note that all JDKs referred to in Comment#2 are from Oracle/Sun.

I have run the modified test on several more JDKs. Here is the summary:

Need a fix:
* Oracle/Sun 1.6.0_26, 1.6.0_45: the order is scheduled, slept, hello
* OpenJDK 1.6.0_24: the "hello" output is not coming at all. 
* IBM JDK 6.0-16.30: the order is scheduled, slept, hello

OK:
* Oracle 7, 8: the order is scheduled, hello, slept 
* OpenJDK 1.8.0_102: the order is scheduled, hello, slept 
* IBM JDK 7.1-2.10: the order is scheduled, hello, slept
* IBM JDK 8.0-0.0: the order is scheduled, hello, slept

Untested:
* OpenJDK 1.7 unable to install

Comment 4 Peter Palaga 2016-09-16 13:09:46 UTC
Setting UpstreamNotAffected because newer EAP versions are not supported on Java 6.

Comment 9 Peter Mackay 2016-11-16 16:22:54 UTC
The issue is fixed in EAP 6.4.12.CP.CR1 for both Oracle and OpenJDK. However, I am still able to reproduce it when using IBM 1.6 JDK.

Comment 12 Peter Mackay 2016-11-23 15:42:08 UTC
Since the IBM Java issue is tracked in a separate BZ, setting this to verified.

Comment 13 Petr Penicka 2017-01-17 13:14:43 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 14 Petr Penicka 2017-01-17 13:16:02 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.


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