sparql.anything icon indicating copy to clipboard operation
sparql.anything copied to clipboard

Maven Build Failure on Windows 10 (Bug)

Open MarcoR1791 opened this issue 2 years ago • 20 comments

When running "mvn install" on the sparql.anything directory the following is obtained:

Results:

Failed tests: testWithOnDiskGraph1(com.github.sparqlanything.csv.CSVTriplifierTest): expected 21 quads but found 34 testWithOnDiskGraph2(com.github.sparqlanything.csv.CSVTriplifierTest): expected 13 quads but found 34

Attached below the full test report from the Powershell: TestPrintOutSPARQLAny.txt

MarcoR1791 avatar Jun 16 '22 16:06 MarcoR1791

I made a change on the test, can you please try again after updating your working copy with git pull?

enridaga avatar Jun 16 '22 17:06 enridaga

I realized I only changed one of the two tests in the first commit! Now it's time to try again :)

enridaga avatar Jun 17 '22 08:06 enridaga

I have just re-run the test after pulling the latest commit but it still fails the second test unfortunately:

Results :

Failed tests: testWithOnDiskGraph2(com.github.sparqlanything.csv.CSVTriplifierTest): expected 13 quads but found 34

Please see the attachment for the Powelshell details: Test2Output.txt

MarcoR1791 avatar Jun 17 '22 08:06 MarcoR1791

First, make sure you do mvn clean install just to make sure the building target dir is empty.

[main] ERROR com.github.sparqlanything.model.BaseFacadeXGraphBuilder - org.apache.commons.io.IOExceptionList: 1 exceptions: [java.io.IOException: Unable to delete file: C:\Users\Marco\GitProjects\sparql.anything\sparql-anything-csv\target\test-classes\tmp\9938521203035839544\Data-0001]

I don't understand this line ... can you please try by changing line 169 as follows:

169 File tmp = new File(getClass().getClassLoader().getResource(".").getPath(), "/tmp2/"); 

basically, change the name of the folder from tmp to tmp2

It's difficult as I don't have a windows 10 myself and cannot reproduce...

enridaga avatar Jun 17 '22 09:06 enridaga

Looking at the code, I am not quite sure what it is supposed to happen after this error anyway as the code proceeds gracefully:

https://github.com/SPARQL-Anything/sparql.anything/blob/ba17609cb4a00838bce074a013e348f2d8ff8b25/sparql-anything-model/src/main/java/com/github/sparqlanything/model/BaseFacadeXGraphBuilder.java#L60-L80

@justin2004 what's your opinion on this one?

enridaga avatar Jun 17 '22 09:06 enridaga

I have made the suggested change to CSVTriplifierTest.java and ran mvn clean install.

Exactly the same error message resulted.

MarcoR1791 avatar Jun 17 '22 09:06 MarcoR1791

Interesting. Let me get a Windows 10 VM running and I'll see if I can reproduce it.

justin2004 avatar Jun 18 '22 02:06 justin2004

We are looking towards a release v0.8.0 -- maybe we should move this one to the next milestone v0.9.0?

enridaga avatar Aug 11 '22 07:08 enridaga

let me see if i can reproduce this tomorrow. if i can't then we can move it to the next milestone.

justin2004 avatar Aug 12 '22 17:08 justin2004

I suspect that this problem may be resolved after #298 #299 and #300

enridaga avatar Sep 08 '22 15:09 enridaga

@MarcoR1791 can you please try again with the latest version of branch v0.8-DEV -- the problems may have disappeared after the recent changes (or it would be useful to check if we get new/different problems).

enridaga avatar Sep 14 '22 09:09 enridaga

Hi Enrico,

I'm afraid the problem persists. I've just obtained the following:

Tests in error: testWithOnDiskGraph1(com.github.sparqlanything.csv.CSVTriplifierTest): 1 exceptions: [java.io.IOException: Unable to delete file: C:\Users\Marco\GitProjects\sparql.anything\sparql-anything-csv\target\test-classes\testOndiskGraph1\Data-0001] testWithOnDiskGraph2(com.github.sparqlanything.csv.CSVTriplifierTest): 1 exceptions: [java.io.IOException: Unable to delete file: C:\Users\Marco\GitProjects\sparql.anything\sparql-anything-csv\target\test-classes\testWithOnDiskGraph2\Data-0001]

MarcoR1791 avatar Sep 15 '22 11:09 MarcoR1791

Let me see if I can reproduce the errors. I'm installing Windows 10 on a Virtual Machine.

luigi-asprino avatar Sep 16 '22 09:09 luigi-asprino

It seems that the test fails because it raises an exceptions when it tries to delete the temporary folder for the TDB (which, for an unknown reason, results in-use here ). We can change deleteDirectory(tmp) with deleteQuitely(tmp) so as to avoid exceptions to be raised and use an OS independent temporary directory for the TDB (see #296) (so the folder will be removed sooner or later).

luigi-asprino avatar Sep 21 '22 14:09 luigi-asprino

With be26802 the tests don't fail anymore on my Win10 VM, so I think we can close the issue and proceed with the release #306. Please @MarcoR1791 let us know if you still experience the problem.

luigi-asprino avatar Sep 21 '22 14:09 luigi-asprino

Hi @luigi-asprino, @enridaga

I've run the 'mvn clean install' and the csv tests pass. There is however a new failure at the markdown triplifier test:

Results :

Failed tests: testFencedCodeBlock(com.github.sparqlanything.markdown.MARKDOWNTriplifierTest) testYamlFrontMatter(com.github.sparqlanything.markdown.MARKDOWNTriplifierTest) testIndentedCodeBlock(com.github.sparqlanything.markdown.MARKDOWNTriplifierTest)

Would you guys like me to open a new issue?

MarcoR1791 avatar Sep 22 '22 14:09 MarcoR1791

Yes, please. Could you please also report the message error?

luigi-asprino avatar Sep 22 '22 15:09 luigi-asprino

@MarcoR1791, please have a look at #366. I think the problem has been solved with that issue.

luigi-asprino avatar Sep 26 '22 11:09 luigi-asprino

Hi @luigi-asprino.

Just cloned a fresh copy of the software and tried to install it. The markdown issue has been fixed but there is a new one when testing archive:

Results :

Failed tests: testMatches(com.github.sparqlanything.zip.test.FolderTriplifierTest): expected:<[, test.txt, test.csv, test.xml]> but was:<[]>

Stack trace:

Running com.github.sparqlanything.zip.test.FolderTriplifierTest false [ a http://sparql.xyz/facade-x/ns/root ] . Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.407 sec <<< FAILURE! testMatches(com.github.sparqlanything.zip.test.FolderTriplifierTest) Time elapsed: 0.219 sec <<< FAILURE! java.lang.AssertionError: expected:<[, test.txt, test.csv, test.xml]> but was:<[]> at org.junit.Assert.fail(Assert.java:89) at org.junit.Assert.failNotEquals(Assert.java:835) at org.junit.Assert.assertEquals(Assert.java:120) at org.junit.Assert.assertEquals(Assert.java:146) at com.github.sparqlanything.zip.test.FolderTriplifierTest.testMatches(FolderTriplifierTest.java:121) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

MarcoR1791 avatar Sep 26 '22 17:09 MarcoR1791

This is strange because the test passes on my VM.

luigi-asprino avatar Sep 27 '22 14:09 luigi-asprino

What's the status of this one? If Luigi can't reproduce, @MarcoR1791, WDYT?

enridaga avatar Dec 15 '22 12:12 enridaga

There is a problem with local paths used in tests with ondisk option (e.g. IssuesTest.test295 IssuesTest.test280_2). The test first instantiates a file with the path of the TDB, then, passes the absolute path of the file as an option. In doing that the path separator becomes a backslash since it is the standard in Windows. However, the backslash is interpreted as an escape character and breaks the path.

luigi-asprino avatar Nov 14 '23 08:11 luigi-asprino

f45decc fixes the problem with paths. However, it seems that there is still a problem with the test for the issue #295. The test raises an exception when it tries to delete the folder containing the TDB of a previous slice. For a strange reason, this happens only on Windows.

luigi-asprino avatar Nov 14 '23 10:11 luigi-asprino

I reported on Jena repository the problem with deleting the TDB2. Apart from that which causes the test #295 to fail, the Maven build on Windows goes smoothly.

luigi-asprino avatar Nov 14 '23 13:11 luigi-asprino

Unfortunately, it falls into a known JVM problem with Windows. Once the file is mapped, it can be deleted only once the JVM terminates. However, we can clear the TDB instead of deleting its folder. This behaviour is implemented in 41a1b24.

luigi-asprino avatar Nov 14 '23 15:11 luigi-asprino

Finally, the Maven build seems to work on Windows 10.

luigi-asprino avatar Nov 14 '23 15:11 luigi-asprino

I think this can be closed now.

luigi-asprino avatar Nov 14 '23 15:11 luigi-asprino