Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330127

Summary: Test execution randomly fails with IOExcpetion
Product: [Modeling] EMF Reporter: Martin Fluegge <martin.fluegge>
Component: cdo.coreAssignee: Martin Fluegge <martin.fluegge>
Status: CLOSED WORKSFORME QA Contact: Eike Stepper <stepper>
Severity: minor    
Priority: P3 Flags: stepper: review-
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch v1
none
Patch v2 none

Description Martin Fluegge CLA 2010-11-12 13:55:11 EST
When executing AllTests, randomly an IOException occurs (see below). 

It seems to be an Windows XP issue since it was reproducible on both of my machines, but did not appear on Windows 7. However, in the worst case this prevent the server on port 7777 to terminate correctly which keeps the port open so that following test cases could not start.

org.eclipse.emf.cdo.tests.config.impl.ConfigTestException: Error in UnsetTest.testIsSetMultipleTimes [Combined, MEMBranches, JVM, Native]
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:466)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at org.eclipse.net4j.util.tests.AbstractOMTest.run(AbstractOMTest.java:196)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite$TestWrapper.runTest(ConfigTestSuite.java:126)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.eclipse.net4j.util.io.IORuntimeException: java.io.IOException: Zugriff verweigert
	at org.eclipse.net4j.util.io.TMPUtil.createTempFolder(TMPUtil.java:91)
	at org.eclipse.net4j.util.io.TMPUtil.createTempFolder(TMPUtil.java:71)
	at org.eclipse.net4j.util.io.TMPUtil.createTempFolder(TMPUtil.java:66)
	at org.eclipse.net4j.util.io.TMPUtil.createTempFolder(TMPUtil.java:61)
	at org.eclipse.emf.cdo.tests.config.impl.SessionConfig.configureSession(SessionConfig.java:159)
	at org.eclipse.emf.cdo.tests.config.impl.SessionConfig$Net4j.configureSession(SessionConfig.java:288)
	at org.eclipse.emf.cdo.tests.config.impl.SessionConfig.openSession(SessionConfig.java:84)
	at org.eclipse.emf.cdo.tests.config.impl.SessionConfig.openSession(SessionConfig.java:75)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.openSession(ConfigTest.java:268)
	at org.eclipse.emf.cdo.tests.UnsetTest.commitAndLoadTx(UnsetTest.java:553)
	at org.eclipse.emf.cdo.tests.UnsetTest.testIsSetMultipleTimes(UnsetTest.java:354)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at org.eclipse.net4j.util.tests.AbstractOMTest.runBare(AbstractOMTest.java:150)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:457)
	... 18 more
Caused by: java.io.IOException: Zugriff verweigert
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.checkAndCreate(File.java:1345)
	at java.io.File.createTempFile(File.java:1434)
	at org.eclipse.net4j.util.io.TMPUtil.createTempFolder(TMPUtil.java:82)
	... 35 more
Comment 1 Martin Fluegge CLA 2010-11-12 13:59:07 EST
Created attachment 183028 [details]
Patch v1

I attached a fix for the problem.

Eike, I remember that we had a more complex fix for this issue but it is somehow lost. I also remember that I had some random deadlocks on the other solution. This one works...by now ;)

If oyu like we can have another look at this topic.
Comment 2 Martin Fluegge CLA 2010-11-13 04:38:11 EST
Committed to HEAD.
Comment 3 Martin Fluegge CLA 2011-01-23 08:46:02 EST
The problem still exists, so I re-open this one.
Comment 4 Martin Fluegge CLA 2011-01-23 08:48:40 EST
Created attachment 187380 [details]
Patch v2

I suggest to protect any call of "createTempFolder()" with an additional time suffix. This definitively avoids the conflicts.

Eike, what do you think about this?
Comment 5 Martin Fluegge CLA 2011-02-13 16:18:06 EST
After discussion with Eike it seems that the TMPUtil.createTempFolder() should be changed to use an own method for creating temp folders instead of using the current approach. 
I'll see that I write such mechanism.
Comment 6 Eike Stepper CLA 2011-02-13 16:19:16 EST
Thanks ;-)
Comment 7 Eike Stepper CLA 2011-05-25 06:46:32 EDT
Is this issue resolved?
Comment 8 Martin Fluegge CLA 2011-05-25 07:02:45 EDT
I am afraid not.
Comment 9 Eike Stepper CLA 2011-05-25 07:20:45 EDT
Please reopen if the problem can be reproduced or you have a fix that helps you and does not harm others ;-)
Comment 10 Eike Stepper CLA 2012-09-21 06:50:29 EDT
Closing.