question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Http2Stream to have independent errors for request and response streams

See original GitHub issue

I am using minio for Object storage. Minio is a golang project using go1.12 as the base go version. The server is HTTP2 enabled. I use using minio java client which uses okhttp3 . when i try to store the object in a bucket in multi threaded mode i get okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR. Refer https://github.com/minio/minio/issues/7501 .

okhttp3.OkHttpClient uses http2.0 by default which causes such issue. If i forcefuly set the protocol to 1.1 ,it works fine. Refer PR https://github.com/minio/minio-java/pull/766.

I find there is some issue with Go1.12 or okhttp3 as i found this issue in the community. Refer https://github.com/square/okhttp/issues/3955 The only solution provided there was to revert to HTTP1_1 .

Setting the protocol to 1.1 is not the solution as i am not using the functionality of HTTP2.0 enabled server. Below is the code which replicates the problem

import io.minio.MinioClient;
class PutObjectRunnable implements Runnable {
   MinioClient client;
   String bucketName;
   String filename;

   public PutObjectRunnable(MinioClient client, String bucketName, String filename) {
       this.client = client;
       this.bucketName = bucketName;
       this.filename = filename;
   }

   public void run() {
       StringBuffer traceBuffer = new StringBuffer();

       try {

           client.putObject(bucketName, filename, filename);

       } catch (Exception e) {
           System.err.print(traceBuffer.toString());
           e.printStackTrace();
       }
   }
}


public class ThreadedPutObject {
    public static void main(String args[]) throws Exception {
	try{
        MinioClient client = new MinioClient("https://play.min.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", true);
        client.traceOn(System.out);
        long startTime = System.currentTimeMillis();
		 boolean found = minioClient.bucketExists("my-bucketname");
      if (found) {
        System.out.println("my-bucketname already exists");
      } else {
        // Create bucket 'my-bucketname'.
        minioClient.makeBucket("my-bucketname");
        System.out.println("my-bucketname is created successfully");
      }        
      Thread[] threads = new Thread[7];
      String[] location = new String[]{"<<PATH_TO_OBJECT_1>>",
                                       "<<PATH_TO_OBJECT_2>>",
                                       "<<PATH_TO_OBJECT_3>>",
                                       "<<PATH_TO_OBJECT_4>>",
                                       "<<PATH_TO_OBJECT_5>>",
                                       "<<PATH_TO_OBJECT_6>>",	
                                       "<<PATH_TO_OBJECT_7>>" };

      for (int i = 0; i < 7; i++) {
            PutObjectRunnable pr = new PutObjectRunnable(client, "my-bucketname",location[i] );
          threads[i] = new Thread(pr);
      }
      for (int i = 0; i < 7; i++) {
        threads[i].start();
      }
            // Waiting for threads to complete.
      for (int i = 0; i < 7; i++) {
         threads[i].join();
          System.out.println(i);
        }
        // All threads are completed.
        } catch (Exception e) {
            throw e;
        }
        System.out.println("uploaded");
    }
}


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:34 (9 by maintainers)

github_iconTop GitHub Comments

12reactions
PhilippCcommented, Mar 2, 2020

@swankjesse I would like to point out that I have lots of users who are waiting for a fix on this (https://github.com/PhilippC/keepass2android/issues/747), so if it is possible in any way to keep the milestone fixed to 4.5 I’d be really happy, as I have seen this being moved from 4.3 to 4.4 and now 4.5. Anyway: Thanks for your hard work! I really appreciate it and I totally understand that features are shifted to later milestones, so please don’t see this as criticism. I just want to make sure you are aware that this is a real issue for real people 😃

7reactions
swankjessecommented, Oct 27, 2019

Can fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 9113 - HTTP/2 - IETF Datatracker
A "stream" is an independent, bidirectional sequence of frames exchanged between the client and server within an HTTP/2 connection. Streams have several ...
Read more >
Introduction to HTTP/2 - web.dev
HTTP/2 (or h2) is a binary protocol that brings push, multiplexing streams and frame control to the web.
Read more >
HTTP/2 - High Performance Browser Networking (O'Reilly)
HTTP/2 resolves these inefficiencies: request queuing and head-of-line blocking is eliminated because the browser can dispatch all requests the moment they are ...
Read more >
Can gRPC Java client send multiple requests in parallel over ...
"request is buffered in the gRPC client" is the correct answer: ... can have multiple independent streams (1 HTTP/2 stream per 1 gRPC...
Read more >
HTTP/2 support within SV | Service Virtualization
The Server will then respond to the request with either the desired ... via a unique HTTP/2 stream over an existing TCP/IP connection....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found