Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser#pause errors due to int overflow #605

dforegger opened this issue Feb 27, 2020 · 2 comments

Browser#pause errors due to int overflow #605

dforegger opened this issue Feb 27, 2020 · 2 comments


Copy link

dforegger commented Feb 27, 2020


When calling Browser.pause() it always errors immediately with geb.waiting.WaitTimeoutException: condition did not pass in 2147483647 seconds (failed with exception).


I suspect this was broken by 19f9edc11a9a33bcb6f887e555db4eec59d84051 when the double Wait#toMilliseconds(Number) was converted to return an int. The pause code calls waitFor with Integer.MAX_VALUE, so the conversion to milliseconds overflows.

Suggested Fix

Option 1

Update toMilliseconds to return a long. This is more robust and safer, but more invasive.

Option 2

Update pause to use a value less than the MAX_VALUE / 1000.

Additional Info


It looks like the test coverage for the pause method - covered in PauseSpec.groovy - does not catch the error because the pause method is called in a separate thread


Below is my full stacktrace (redacted company info, sorry):

    geb.waiting.WaitTimeoutException: condition did not pass in 2147483647 seconds (failed with exception)
        at geb.waiting.Wait.waitFor(Wait.groovy:124)
        at geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:50)
        at geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:41)
        at geb.Page.waitFor(Page.groovy:115)
        at geb.Browser.methodMissing(Browser.groovy:250)
        at geb.Browser.pause(Browser.groovy:922)
        at geb.spock.GebSpec.methodMissing(GebSpec.groovy:60)
       <at spec method call>

        Caused by:
        Assertion failed: 

        |  |
        |  false
            at geb.Browser.pause_closure5(Browser.groovy:923)
            at geb.Browser.pause_closure5(Browser.groovy)
            at geb.waiting.Wait.waitFor(Wait.groovy:103)
            ... 7 more


Geb: v3.1
Gradle 4.7
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_144 (Azul Systems, Inc. 25.144-b01)
OS: Mac OS X 10.15.1 x86_64

Copy link

erdi commented Feb 29, 2020

Thanks for a high quality bug report, @dforegger. I'm impressed that you made the effort to figure out what the problems are with both production and test code which lead to the issue itself and then allow it slip past the verification. It's highly appreciated and made fixing the test and the issue a breeze.

Copy link

dforegger commented Mar 2, 2020

Thanks for the quick fix. Appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants