Code Monkey home page Code Monkey logo

Comments (6)

vietj avatar vietj commented on June 16, 2024

the problem happens with keep-alive.

what is the code creating the HttpClient ?

from vertx-config.

vietj avatar vietj commented on June 16, 2024

does it happen inside the same verticle or from a main/test method ?

from vertx-config.

ruslansennov avatar ruslansennov commented on June 16, 2024

does it happen inside the same verticle or from a main/test method ?

It happens from a test methods but there is issue in vertx-consul-client with the same problem.
I made some experiments with ConsulConfigStoreTest:

  @Test
  public void getSimpleConfig(TestContext tc) {
    Async async = tc.async();
    createRetriever();
    System.out.println(Vertx.currentContext());  // (1)
    client.putValue("foo/bar", "value", ar -> {
      System.out.println(Vertx.currentContext());  // (2)
      tc.assertTrue(ar.succeeded());
      retriever.getConfig(json2 -> {
        System.out.println(Vertx.currentContext());  // (3)
        assertThat(json2.succeeded()).isTrue();
        JsonObject config2 = json2.result();
        tc.assertTrue(!config2.isEmpty());
        tc.assertEquals(config2.getString("bar"), "value");
        client.deleteValues("foo", h -> async.complete());
      });
    });
  }

If I run the test by executing the entire class, I see the above warning and:

mvn test -Dtest=ConsulConfigStoreTest

(1) null
WARNING: Reusing a connection with a different context: an HttpClient is probably shared between different Verticles
(2) io.vertx.core.impl.EventLoopContext@1ba3412b
(3) io.vertx.core.impl.EventLoopContext@37c2490c
WARNING: Reusing a connection with a different context: an HttpClient is probably shared between different Verticles

But if I run the getSimpleConfig test only, then I see no warnings and:

mvn test -Dtest=ConsulConfigStoreTest#getSimpleConfig

(1) null
(2) io.vertx.core.impl.EventLoopContext@512f413d
(2) io.vertx.core.impl.EventLoopContext@512f413d

@vietj @cescoffier any thoughts on this?

from vertx-config.

vietj avatar vietj commented on June 16, 2024

I think the best would be to capture a Context in consul client when it is created and then use runOnContext to use the HttpClient.

from vertx-config.

cescoffier avatar cescoffier commented on June 16, 2024

I'm not sure it should be done in the consul client or in the config store. For vault I'm doing it in the config store.

from vertx-config.

ruslansennov avatar ruslansennov commented on June 16, 2024

Thank you guys. Due to the issues not belongs to vertx-config, I decided to make all the changes in the parent project

from vertx-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.