#15 ✓resolved
Mike West

`test_exceed_time` fails on JeOS

Reported by Mike West | May 16th, 2009 @ 09:44 AM

On a minimal JeOS (Ubuntu-based) system, test_exceed_time fails. It fails in a particularly exciting way, in that it gets stuck in an infinite loop and sucks up 100% CPU checking to see if true ever happens to equal false. :)

Aside from tracking down the bug, I'd suggest rewriting the test such that it fails gracefully. Something like:

@t.cx()
def test_exceed_time(cx):
    cx.max_time(1)
    import time
    start = time.time()
    try:
        cx.execute("""
            var start = ( new Date() ).getTime(),
                end   = 0;
            while( ( end - start ) < 1500  ) {
                end = ( new Date() ).getTime();
            }
        """);
        assert ( time.time() - start ) < 1, "Execution exceeded 1 second without throwing an error."
    except RuntimeError:
        return "Yay!  We caught a runtime error!";

Is one way to do that, but there's likely a much cleverer solution. :)

What info can I pass over to help diagnose the failure?

Comments and changes to this ticket

  • Mike West

    Mike West May 16th, 2009 @ 09:48 AM

    test_get_set_limits fails as well. I was going to file another bug for that issue, but now that I look at it, I think it's related. max_time doesn't appear to correctly set the maximum execution time, which means that the test_exceed_time never times out. Traceback follows:

    ======================================================================
    FAIL: test-context.test_get_set_limits
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/mikewest/src/python-spidermonkey/nose-0.11.1-py2.6.egg/nose/case.py", line 183, in runTest
        self.test(*self.arg)
      File "/home/mikewest/src/python-spidermonkey/nose-0.11.1-py2.6.egg/nose/util.py", line 630, in newfunc
        return func(*arg, **kw)
      File "/home/mikewest/src/python-spidermonkey/tests/t.py", line 12, in run
        func(*self.args())
      File "/home/mikewest/src/python-spidermonkey/tests/test-context.py", line 35, in test_get_set_limits
        t.eq(cx.max_time(), 10)
      File "/home/mikewest/src/python-spidermonkey/tests/t.py", line 45, in eq
        assert a == b, "%r != %r" % (a, b)
    AssertionError: -4294967286L != 10
    
    ----------------------------------------------------------------------
    
  • Paul J. Davis

    Paul J. Davis May 16th, 2009 @ 04:57 PM

    • State changed from “new” to “open”

    (from [4134ea66e00b6c6b1d80266ef61073d836a81477]) Fix for time limit constraints.

    The root bug I think has to do with conversions between integral types. I
    changed the Context.max_time method to be a bit less clever which will hopefully
    fix things. I also updated the test_exceeds_time to fail more gracefully as per
    suggestion.

    Thanks to Mike West

    [#15 state:open] http://github.com/davisp/python-spidermonkey/commit/4134ea66e00b6c6...

  • Paul J. Davis

    Paul J. Davis May 16th, 2009 @ 04:59 PM

    Mike,

    Can you pull trunk and see if the new test works for you? If not I'm pretty certain it has to do with the type conversions I'm doing in max_time. Are you by chance on a 64 bit architecture?

  • Mike West

    Mike West May 16th, 2009 @ 05:52 PM

    Looks good, Paul. :)

    You're correct: I'm running JeOS 64 bit inside VMWare. I pulled the latest trunk, and the max time tests pass. Nice work.. and quick!

  • Paul J. Davis

    Paul J. Davis May 16th, 2009 @ 05:57 PM

    • State changed from “open” to “resolved”

    Awesome. I'm gonna close this ticket but when I get a chance at work I'll see if I can't find something more better than to limit time ranges to int's.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Python/JavaScript bridge module, making use of Mozilla's spidermonkey JavaScript implementation. Allows implementation of JavaScript classes, objects and functions in Python, and evaluation and calling of JavaScript scripts and functions respectively. Borrows heavily from Claes Jacobssen's Javascript Perl module, in turn based on Mozilla's 'PerlConnect' Perl binding.

People watching this ticket

Tags

Referenced by

Pages