Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with LZ4Block{Input,Output}Stream #11

Closed
mooreb opened this issue Feb 11, 2013 · 9 comments
Closed

problems with LZ4Block{Input,Output}Stream #11

mooreb opened this issue Feb 11, 2013 · 9 comments

Comments

@mooreb
Copy link

mooreb commented Feb 11, 2013

Hi Adrien,

I tried your new LZ4Block{Input,Output}Stream as published in:
http://search.maven.org/#artifactdetails|net.jpountz.lz4|lz4|1.1.0|jar

and unfortunately I had problems.

I have committed the passing and failing tests into:
https://github.com/mooreb/lz4-java-stream/tree/master/tests-2013-02-11/for-jpountz

The error I am experiencing is:

java.lang.AssertionError: Bytes differed! Seed value was 1360613556874 expected:<-123> but was:<26>
    at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
    at org.testng.AssertJUnit.failNotEquals(AssertJUnit.java:364)
    at org.testng.AssertJUnit.assertEquals(AssertJUnit.java:80)
    at org.testng.AssertJUnit.assertEquals(AssertJUnit.java:200)
    at net.jpountz.lz4.LZ4StreamTest.assertEqualContent(LZ4StreamTest.java:148)
    at net.jpountz.lz4.LZ4StreamTest.assertContentInSingleBlock(LZ4StreamTest.java:133)
    at net.jpountz.lz4.LZ4StreamTest.randomizedTest(LZ4StreamTest.java:95)
    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:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
java.lang.AssertionError: Exception was thrown.  Seed value was 1360613556874
    at org.testng.AssertJUnit.fail(AssertJUnit.java:59)
    at net.jpountz.lz4.LZ4StreamTest.randomizedTest(LZ4StreamTest.java:106)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
    at org.testng.TestNG.run(TestNG.java:1031)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
    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:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

The difference between the passing and failing tests is below:

$ diff -Naur passing-test/LZ4StreamTest.java failing-test/LZ4StreamTest.java
--- passing-test/LZ4StreamTest.java 2013-02-11 12:42:55.000000000 -0800
+++ failing-test/LZ4StreamTest.java 2013-02-11 12:43:15.000000000 -0800
@@ -39,7 +39,7 @@
     private void compressContent() throws IOException {
         ByteArrayOutputStream compressedOutputStream = new ByteArrayOutputStream();
 
-        LZ4OutputStream os = new LZ4OutputStream(compressedOutputStream);
+        LZ4BlockOutputStream os = new LZ4BlockOutputStream(compressedOutputStream);
@@ -77,7 +77,7 @@
     @Test
     public void randomizedTest() throws IOException {
         try {
-            InputStream is = new LZ4InputStream(new ByteArrayInputStream(compressedOutput));
+            InputStream is = new LZ4BlockInputStream(new ByteArrayInputStream(compressedOutput));
             int currentContentPosition = 0;
 

Hoping this helps and finds you well,

b

@jpountz
Copy link
Collaborator

jpountz commented Feb 11, 2013

Very good point, thanks Brian, the bug is in LZ4BlockOutputStream.write(int). I'll fix it...

@jpountz
Copy link
Collaborator

jpountz commented Feb 11, 2013

Brian, can you confirm the bug is fixed?

@mooreb
Copy link
Author

mooreb commented Feb 11, 2013

I can't, because I can't build; both 'ant' and 'ant jar' fail in the same place. Please see below.Sorry,b$ ant jarPicked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Xmx32gBuildfile: /Users/mooreb/git/lz4-java/build.xmlinit:[ivy:resolve] :: Ivy 2.2.0 - 20100923230623 :: http://ant.apache.org/ivy/ ::[ivy:resolve] :: loading settings :: url = jar:file:/Users/mooreb/.ant/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml[ivy:resolve] :: resolving dependencies :: net.jpountz.lz4#lz4;1.1-SNAPSHOT[ivy:resolve]     confs: [test][ivy:resolve]     found com.carrotsearch.randomizedtesting#junit4-ant;1.6.0 in public[ivy:resolve]     found org.apache.ant#ant;1.8.2 in public[ivy:resolve]     found org.apache.ant#ant-launcher;1.8.2 in public[ivy:resolve]     found org.apache.ant#ant-junit;1.8.2 in public[ivy:resolve]     found junit#junit;4.10 in public[ivy:resolve]     found org.hamcrest#hamcrest-core;1.1 in public[ivy:resolve]     found com.google.guava#guava;10.0.1 in public[ivy:resolve]     found com.google.guava#guava-bootstrap;10.0.1 in public[ivy:resolve]     found asm#asm;3.3.1 in public[ivy:resolve]     found commons-io#commons-io;2.1 in public[ivy:resolve]     found com.google.code.gson#gson;2.0 in public[ivy:resolve]     found org.simpleframework#simple-xml;2.6.2 in public[ivy:resolve]     found stax#stax-api;1.0.1 in public[ivy:resolve]     found stax#stax;1.2.0 in public[ivy:resolve]     found xpp3#xpp3;1.1.3.3 in public[ivy:resolve]     found com.carrotsearch.randomizedtesting#randomizedtesting-runner;1.6.0 in public[ivy:resolve] :: resolution report :: resolve 506ms :: artifacts dl 23ms[ivy:resolve]     :: evicted modules:[ivy:resolve]     junit#junit;3.8.2 by [junit#junit;4.10] in [test]    ---------------------------------------------------------------------    |                  |            modules            ||   artifacts   |    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|    ---------------------------------------------------------------------    |       test       |   17  |   0   |   0   |   1   ||   16  |   0   |    ---------------------------------------------------------------------[ivy:retrieve] :: retrieving :: net.jpountz.lz4#lz4[ivy:retrieve]     confs: [test][ivy:retrieve]     0 artifacts copied, 16 already retrieved (0kB/12ms)compile-java:install-cpptasks:[ivy:cachepath] :: resolving dependencies :: ant-contrib#cpptasks-caller;working[ivy:cachepath]     confs: [default][ivy:cachepath]     found ant-contrib#cpptasks;1.0b5 in public[ivy:cachepath]     found ant#ant;1.6.5 in public[ivy:cachepath]     found xerces#xercesImpl;2.8.1 in public[ivy:cachepath]     found xml-apis#xml-apis;1.3.03 in public[ivy:cachepath] :: resolution report :: resolve 66ms :: artifacts dl 4ms    ---------------------------------------------------------------------    |                  |            modules            ||   artifacts   |    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|    ---------------------------------------------------------------------    |      default     |   4   |   0   |   0   |   0   ||   4   |   0   |    ---------------------------------------------------------------------generate-headers:    [javah] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Xmx32gcompile-jni:[cpptasks:cc] Starting dependency analysis for 3 files.[cpptasks:cc] 3 files are up to date.[cpptasks:cc] 0 files to be recompiled from dependency analysis.[cpptasks:cc] 2 total files to be compiled.[cpptasks:cc] In file included from /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:16:[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:2:17: error: jni.h: No such file or directory[cpptasks:cc] In file included from /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:16:[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:48: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_lz4_LZ4JNI.h:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OutOfMemoryError’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:30: error: expected ‘)’ before ‘*’ token[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:95: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:123: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_lz4_LZ4JNI.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] In file included from /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:17:[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:2:17: error: jni.h: No such file or directory[cpptasks:cc] In file included from /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:17:[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jlong’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:48: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:56: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/build/jni-headers/net_jpountz_xxhash_XXHashJNI.h:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘OutOfMemoryError’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:31: error: expected ‘)’ before ‘*’ token[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:61: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jlong’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:73: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘jint’[cpptasks:cc] /Users/mooreb/git/lz4-java/src/jni/net_jpountz_xxhash_XXHashJNI.c:117: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’BUILD FAILED/Users/mooreb/git/lz4-java/build.xml:141: gcc failed with return code 1Total time: 2 seconds

@jpountz
Copy link
Collaborator

jpountz commented Feb 11, 2013

Strange, the changes I performed seem to be unrelated. Can you try with this JAR? http://oss.sonatype.org/content/repositories/snapshots/net/jpountz/lz4/lz4/1.1-SNAPSHOT/lz4-1.1-20130211.233145-3.jar

@mooreb
Copy link
Author

mooreb commented Feb 12, 2013

I can confirm that my test now passes with the snapshot your provided.

b

@jpountz
Copy link
Collaborator

jpountz commented Feb 12, 2013

Thank you. I'll release a new artifact soon (likely 1.1.1).

@mooreb
Copy link
Author

mooreb commented Feb 12, 2013

I look forward to it. Thanks,b

-------- Original Message --------
Subject: Re: [lz4-java] problems with LZ4Block{Input,Output}Stream
(#11)
From: Adrien Grand [email protected]
Date: Mon, February 11, 2013 4:16 pm
To: jpountz/lz4-java [email protected]
Cc: Brian Moore [email protected] you. I'll release a new artifact soon (likely 1.1.1). — Reply to this email directly or view it on GitHub.

@jpountz
Copy link
Collaborator

jpountz commented Feb 12, 2013

@mooreb
Copy link
Author

mooreb commented Feb 13, 2013

Thanks Adrien. This release has passed my initial testing. I'll let you know if I have any subsequent problems with it.Hoping this finds you well,b

-------- Original Message --------
Subject: Re: [lz4-java] problems with LZ4Block{Input,Output}Stream
(#11)
From: Adrien Grand [email protected]
Date: Tue, February 12, 2013 2:54 pm
To: jpountz/lz4-java [email protected]
Cc: Brian Moore [email protected] it is http://repo1.maven.org/maven2/net/jpountz/lz4/lz4/1.1.1/ — Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants