Skip to content

Intermittent failure in /XMLHttpRequest/event-timeout.htm #3396

Closed

Description

@jdm

This one's fun - the test sets a 5ms timeout on the XHR, and calls setTimeout with a delay of 10ms. The test asserts that the setTimeout is never reached, because the ontimeout handler ends the test. Our timer implementation is messy, in that both the XHR and setTimeout timers have their own tasks which send a message to the script task when they expire. That means that scheduling-wise we have no guarantees that lower timer values will expire and notify the script task before the timers with higher values.

Activity

  1. added
    A-content/dom
    I-wrong
    I-intermittent
    on Sep 17, 2014
  2. jdm commented on Sep 17, 2014

    @jdm
    MemberAuthor

    Maybe we need a timer task that accepts requests for new timers along with a closure to run when it expires?

  3. Manishearth commented on Sep 18, 2014

    @Manishearth
    Member

    Note: this line might be a part of the issue, however send_opt is non blocking so I don't think it should be.

    The timer task seems like a good idea.

  4. jdm commented on Sep 18, 2014

    @jdm
    MemberAuthor

    I did rearrange the lines in the SpiderMonkey upgrade branch and I still saw the failure regularly when the system was under load.

  5. changed the title [-]Intermittent timeout in /XMLHttpRequest/event-timeout.htm[/-] [+]Intermittent failure in /XMLHttpRequest/event-timeout.htm[/+] on Nov 12, 2014
  6. jdm commented on Nov 12, 2014

    @jdm
    MemberAuthor
     0:26.54 TEST_START: Thread-TestrunnerManager-1 /XMLHttpRequest/event-timeout.htm
     0:26.72 TEST_END: Thread-TestrunnerManager-1 Harness OK. Subtests passed 0/1. Unexpected 1
    XMLHttpRequest: timeout event
    -----------------------------
    Expected PASS, got FAIL
    assert_unreached: ontimeout not called. Reached unreachable code
    
  7. Manishearth commented on Nov 13, 2014

    @Manishearth
    Member

    Apparently this is now a constant failure on the mac builders (but not on a normal mac), post-upgrade.

    I asked @glennw to disable it for now, but we should look into this again.

  8. added 2 commits that reference this issue on Dec 3, 2014
  9. added
    B-interesting-project
    E-more-complex
    on Feb 23, 2015
  10. jdm commented on Feb 23, 2015

    @jdm
    MemberAuthor

    Here's how I want to go about fixing this:

    • create a new timer thread that controls all timers for a constellation
    • internally, it has an event loop that selects on two input receivers
      • one watches for messages that add/remove a timer
      • the other is a timer that waits until the next web content timer should fire
    • when a timer is added:
      • store its creation time and expiry time in a vector sorted by expiry date
      • if the new timer is in the head position (ie. it will expire soonest), reset the event loop timer to the new timer's expiration time
    • when a timer is removed:
      • remove it from the sorted vector
      • if the new timer is in the head position (ie. it will expire soonest), reset the event loop timer to the new head timer's expiration time, or the maximum timer value if there is none
    • when the event loop timer fires:
      • for stored each timer that has an expiry time earlier than the current time
        • send a message to the script task associated with the expired timer in the sorted vector
        • run the steps for removing a timer
        • if the timer should repeat, add it to the sorted vector and run the steps for adding a timer
  11. 10 remaining items

  12. Manishearth commented on May 28, 2015

    @Manishearth
    Member

    extern crate timers won't work, you want to use timers (from within script) or use script::timers from a different crate.

    extern crate script will only work in the compositing lib.rs

    However, it might be worth keeping the dependency separate by moving this to script_traits

    (I'm not sure what you need to use in constellation.rs)

  13. added a commit that references this issue on May 28, 2015
  14. pgonda commented on May 28, 2015

    @pgonda
    Contributor

    Thanks!! That works for the servo/lib.rs but I am still working on the compositing/constellation.rs know anyone that would be able to help?

  15. jdm commented on May 28, 2015

    @jdm
    MemberAuthor

    compositing doesn't depend on the script crate, it depends on script_traits instead. Why does constellation.rs need something from the timers module? Can that something move into the script_traits crate instead?

  16. pgonda commented on Jun 2, 2015

    @pgonda
    Contributor

    Alright, so I will move all the new timer code into script_traits::timer.rs? So that the Constellation can hold the sender to the thread, and pass it to newly created ScriptTasks.

  17. jdm commented on Jun 2, 2015

    @jdm
    MemberAuthor

    I don't believe all of the code needs to move. You might be able to just move the TimerRequest enum to script_traits, if that's all that the Constellation code needs to reference.

  18. benschulz commented on Aug 28, 2015

    @benschulz
    Contributor

    Are you still working on this, @pgonda? If not, I'd like to try my hand at it.

  19. jdm commented on Aug 28, 2015

    @jdm
    MemberAuthor

    According to the conversation at the bottom of master...pgonda:timeout-event-loop-thread you are welcome to tackle this, @benschulz. You should definitely at least look through the prior art there, if not steal it entirely :)

  20. added
    C-assigned
    on Sep 17, 2015
  21. added 2 commits that reference this issue on Oct 20, 2015
  22. added a commit that references this issue on Oct 23, 2015
    3c687fa
  23. added a commit that references this issue on Nov 10, 2015
    d27a324
  24. added a commit that references this issue on Nov 11, 2015
    df81cd7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domB-high-valueB-interesting-projectC-assignedE-more-complexI-intermittentI-wrong

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions