Coder Social home page Coder Social logo

Tests are slow about zdaemon HOT 5 CLOSED

zopefoundation avatar zopefoundation commented on May 31, 2024
Tests are slow

from zdaemon.

Comments (5)

mgedmin avatar mgedmin commented on May 31, 2024

I have an amazing patch that shortens the test runtime to 14s, but it breaks one fragile test (dont_hang_when_program_doesnt_start), BECAUSE THAT TEST IS RACY.

from zdaemon.

mgedmin avatar mgedmin commented on May 31, 2024

dont_hang_when_program_doesnt_start relies on one of two possible sequence of events:

  • get_status() reports that daemon manager is not running
  • ./zdaemon spawns the daemon manager
  • get_status() reports that daemon manager is running but the managed process is not
  • get_status() reports that daemon manager is not running

or

  • get_status() reports that daemon manager is not running
  • ./zdaemon spawns the daemon manager
  • get_status() reports that daemon manager is not running until 10 seconds elapse

The test, however, sets up a situation where

  1. ./zdaemon spawns the daemon manager
  2. the daemon manager spawns the process
  3. the process exits with an error message ("sleep: missing operand")
  4. go to step 2 until backoff-limit is reached (2 seconds)

If the get_status() check hits the window between 2 and 3, the main wait loop will assume the process started correctly and will exit.

Um. I now see that I accidentally moved the time.sleep() inside an if where it should've stayed outside, which made the race easier to hit (and introduced a bug where the timeout was much too short). Once I fixed that the test passes.

from zdaemon.

mgedmin avatar mgedmin commented on May 31, 2024

Ha ha no it doesn't. The race is harder to hit, perhaps, but it's still possible. And the test run time went from 14s to 40 :(.

from zdaemon.

icemac avatar icemac commented on May 31, 2024

@mgedmin Is this issue still valid or can it be closed?

Currently the tests take about 80 s on Python 3.11 in GHA. So it does not seem to be faster than 8 years ago.

from zdaemon.

mgedmin avatar mgedmin commented on May 31, 2024

I have no plans to work on this, so I suppose it can be closed.

from zdaemon.

Related Issues (18)

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.