Giter Site home page Giter Site logo

flaky test about zeroconf HOT 4 CLOSED

marten-seemann avatar marten-seemann commented on September 24, 2024
flaky test

from zeroconf.

Comments (4)

marten-seemann avatar marten-seemann commented on September 24, 2024

Looks like this test got flakier with the recent changes.

from zeroconf.

betamos avatar betamos commented on September 24, 2024

I just ran the race detector in my project and it caught the TTL issue immediately. In my case:

server, _ := zeroconf.Register(...) // Starts the server, which can read the ttl value at any point
server.TTL(1234) // Writes the ttl value without thread safety

So I'd upgrade this from "flaky test" to "actual bug" that will happen. We could:

  1. Use atomic load/store on the ttl value. Note this still has a logical race condition between default ttl and user-provided.
  2. Provide ttl in a new spread arg opts ... to Register (similar to Browse to avoid breaking API).

I'd prefer 2, WDYT? Accepting PRs?

from zeroconf.

marten-seemann avatar marten-seemann commented on September 24, 2024
  1. Use atomic load/store on the ttl value. Note this still has a logical race condition between default ttl and user-provided.

Agreed. This is ugly.

  1. Provide ttl in a new spread arg opts ... to Register (similar to Browse to avoid breaking API).

Sounds good. Looking at the API, it would be nice to get rid of the []net.Interface as well (as we do for the client), but that would be breaking interface change, so let's not do that. Strictly speaking, adding an ...Option is also a breaking change, but we can probably just ignore that to avoid cutting v3 ;)

Is there any real use case for modifying the TTL after the fact? Otherwise, we can just deprecate that function.

Accepting PRs?

Yes! That would be highly appreciated!

from zeroconf.

betamos avatar betamos commented on September 24, 2024

Great! Sent a PR your way. Left the test itself alone for now, since it uses a harness method that I didn't want to fiddle with too much.

Is there any real use case for modifying the TTL after the fact? Otherwise, we can just deprecate that function.

I don't think so either. Something along the lines of "I'm going away soon, so please overwrite your previous TTL with a shorter one" perhaps, and if so also v3 material? Deprecated it in the PR.

from zeroconf.

Related Issues (6)

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.