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

Update to ipfs v0.5.0 #170

Merged
merged 25 commits into from
Jul 31, 2020
Merged

Update to ipfs v0.5.0 #170

merged 25 commits into from
Jul 31, 2020

Conversation

ianopolous
Copy link
Collaborator

@ianopolous ianopolous commented Jul 29, 2020

This fixes all the breaking changes in ipfs v0.5.0.

As well as upgrading dependencies.

@lidel Does this qualify for the two bounties?

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ianopolous, yes, iiuc this ticks all the boxes from #157:

  • Support for POST-only HTTP API from go-ipfs 0.5+
  • Support for CIDv1 in Base32 and Base36
  • Fix tests and CI

Before we merge and close the bounty, some small questions/asks inline.

ps. just to have another set of eyes familiar with Java,
@NadeeraM are you able to check if this branch works for you too?

@NadeeraM

This comment has been minimized.

@ianopolous
Copy link
Collaborator Author

That looks like maven is still using the old dependencies. I don't actually use maven myself, but I'll have a look.

@ianopolous
Copy link
Collaborator Author

@NadeeraM I've just fixed the maven file I think. Are you able to try again?

@NadeeraM
Copy link

NadeeraM commented Jul 29, 2020

@NadeeraM I've just fixed the maven file I think. Are you able to try again?

@ianopolous yes I will check

@NadeeraM

This comment has been minimized.

@NadeeraM

This comment has been minimized.

@ianopolous
Copy link
Collaborator Author

@NadeeraM jitpack.io had got itself into a strange state, but I've bumped a few versions in the dependencies for maven and it is working now.

@NadeeraM
Copy link

NadeeraM commented Jul 30, 2020

@ianopolous yes can compile the code successfully. But Still tests are failing. This is the tests that fail

    public void pubsubSynchronous() throws Exception {
        String topic = "topic" + System.nanoTime();
        List<Map<String, Object>> res = Collections.synchronizedList(new ArrayList<>());
        new Thread(() -> {
            try {
                ipfs.pubsub.sub(topic, res::add, t -> t.printStackTrace());
            } catch (IOException e) {
                throw new RuntimeException(e);}
        }).start();```


Stack trace Error:

```pub => sub took 1
child1: zb2rhXvZfBVfxehiE7VfgL5LbJpUXjkY64bms6hVqpE86zEff
root1: zdpuAte25GgAQNVY9pgWHTj1a33wmWVFmyhLzELamTwAq7eBS
java.net.SocketTimeoutException: Read timed out
        at java.base/java.net.SocketInputStream.socketRead0(Native Method)
        at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
        at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
        at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
        at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
        at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
        at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
        at java.base/sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:552)
        at java.base/sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:609)
        at java.base/sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:696)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3505)
        at java.base/sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3498)
        at io.ipfs.api.IPFS.getObjectStream(IPFS.java:743)
        at io.ipfs.api.IPFS.retrieveAndParseStream(IPFS.java:682)
        at io.ipfs.api.IPFS.access$400(IPFS.java:15)
        at io.ipfs.api.IPFS$Pubsub.sub(IPFS.java:298)
        at io.ipfs.api.APITest.lambda$pubsubSynchronous$6(APITest.java:416)
        at java.base/java.lang.Thread.run(Thread.java:834)

Tests run: 39, Failures: 0, Errors: 2, Skipped: 2, Time elapsed: 243.865 sec <<< FAILURE! - in io.ipfs.api.APITest
pinUpdate(io.ipfs.api.APITest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.IllegalStateException: Unknown Multibase type: /
        at io.ipfs.api.APITest.pinUpdate(APITest.java:253)

rawLeafNodePinUpdate(io.ipfs.api.APITest)  Time elapsed: 0.021 sec  <<< ERROR!
java.lang.IllegalStateException: Unknown Multibase type: /
        at io.ipfs.api.APITest.rawLeafNodePinUpdate(APITest.java:287)


Results :

Tests in error: 
  APITest.pinUpdate:253 » IllegalState Unknown Multibase type: /
  APITest.rawLeafNodePinUpdate:287 » IllegalState Unknown Multibase type: /
  AddTest.add:37 IllegalState Error returned from IPFS: {"Name":"html/chap/ch01....

Tests run: 50, Failures: 0, Errors: 3, Skipped: 2

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:09 min
[INFO] Finished at: 2020-07-31T09:48:55+12:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project java-ipfs-http-client: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/nadeera/Desktop/Work/ipfs/java-ipfs-http-client/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@ianopolous
Copy link
Collaborator Author

The tests all run fine in CI, and if I run them locally using maven against ipfs v0.5.0 then they all pass:

Tests run: 50, Failures: 0, Errors: 0, Skipped: 2

The errors you're getting, @NadeeraM look like your running against an older version of ipfs, 0.4.23 or earlier (when pin update returned multiaddr rather than multihashes). Could you confirm the ipfs version you are testing against?

@NadeeraM
Copy link

NadeeraM commented Jul 30, 2020

The tests all run fine in CI, and if I run them locally using maven against ipfs v0.5.0 then they all pass:

Tests run: 50, Failures: 0, Errors: 0, Skipped: 2

The errors you're getting, @NadeeraM look like your running against an older version of ipfs, 0.4.23 or earlier (when pin update returned multiaddr rather than multihashes). Could you confirm the ipfs version you are testing against?

@ianopolous Yes i am running local ipfs using docker-compose file in this project. Version is "Version": "0.4.16".
Hope better to update that file version as well. :)

image: 'ipfs/go-ipfs:v0.4.16'

Thank you

@ianopolous
Copy link
Collaborator Author

@lidel Any other comments on this? I think it's good to go now.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ianopolous I noticed tests did not run against bundled junit and cid.jar (?) and after adding both in f092411 CI no longer passed (example).

I've re-run the job and it is now green – any idea why previous run failed? Anything we can do to make tests more deterministic, or at least tell us what exactly failed?

Instead use 95% delivery of messages
@ianopolous
Copy link
Collaborator Author

@ianopolous I noticed tests did not run against bundled junit and cid.jar (?) and after adding both in f092411 CI no longer passed (example).

It includes the cid jar via the ipfs.jar manifest.

I've re-run the job and it is now green – any idea why previous run was flaky?

Some of the tests are not strict unit tests because they impose a time limit and are thus more of a performance test of ipfs, like the pubsubSynchronous test. I've rewritten that to ignore the time now and instead require 95% delivery of messages (ipfs pubsub isn't reliable even on the same instance it seems).

@lidel
Copy link
Member

lidel commented Jul 31, 2020

Thank you @ianopolous, expecting 95% delivery of messages should work better than time-based one 👍

👉 I've confirmed this PR works for me locally and satisfies requirements of both bounties.
I believe this closes the double bounty listed in #157please merge this PR and make a new release of this library 🙏

We will finalize bounty details in #157

@lidel lidel mentioned this pull request Jul 31, 2020
2 tasks
@ianopolous ianopolous merged commit 57269c7 into master Jul 31, 2020
@lidel lidel deleted the fix/ipfs-v0.5.0 branch August 18, 2020 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants