Dgraph4j 1.7.1 error: io.netty.handler.codec.http2.Http2Exception: Header size exceeded max allowed size (10240)

I’m trying to use the Java client (dgraph4j 1.7.1) to commit a mutation that has a long ‘string’ value (15k).

The following error occurs:

io.grpc.StatusRuntimeException: INTERNAL: http2 exception
io.netty.handler.codec.http2.Http2Exception: Header size exceeded max allowed size (10240)

I was looking for a way to increase the value using the API, but nothing worked.
Is there a solution?

Mutation mu = Mutation.newBuilder().setSetNquads(ByteString.copyFromUtf8(mutate)).build();
			txn.mutate(mu);
			txn.commit();

Or is there a better way to commit a mutation in RDF format containing long strings?

Hey @tulbrich,

I couldn’t reproduce the problem even with a mutation of roughly ~10Mb (my sample code is below). Plus the error message says the header size is too long, is it possible for you to check what’s in the header? Thanks!

@Test
  public void testLongMutation() {
    String table = "abcdefghijklmnopqrstuvwxyz";
    Random rand = new Random();
    StringBuilder sb = new StringBuilder();
    sb.append("<_:bob> <name> \"");
    for (int i = 0; i < 10 * 1024 * 1024; i++) {
      sb.append(table.charAt(rand.nextInt(26)));
    }
    sb.append("\" .");

    try (Transaction txn = dgraphClient.newTransaction()) {

      Mutation mutation =
          Mutation.newBuilder()
              .setSetNquads(ByteString.copyFromUtf8(sb.toString()))
              .build();
      Assigned ag = txn.mutate(mutation);
      System.out.println("Got new id:" + ag.getUidsOrThrow("bob"));
      txn.commit();
    }
  }
1 Like

The problem is solved. Cause was a wrong encoded ‘’ inside the string.
Possibly one should catch such error cases with a meaningful error message. The problem itself was small, but the error message led to a completely wrong way to solve the problem.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.