protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Protractor hangs with (n) instances of webdriver still running

Open dborin opened this issue 12 years ago • 25 comments

Shutting down selenium standalone server. [launcher] 1 instance(s) of WebDriver still running Shutting down selenium standalone server. [launcher] 1 instance(s) of WebDriver still running

This sat on our Jenkins slave for 11 hours (overnight). You can clearly see where it indicates it there is one instance, it is "Shutting down..." but then there is still one instance.

Thoughts on how I can fix this so I can utilize the excellent sharding feature?

dborin avatar Jul 30 '14 15:07 dborin

I haven't seen this before and unfortunately this log isn't enough information to figure out the cause. Do you see this regularly? Can you share your configuration file?

juliemr avatar Aug 01 '14 22:08 juliemr

https://gist.github.com/dborin/e69e22c7a685577e5a49

I see this on an almost constant basis. So frequently in fact that I've completely removed references to sharding in our Gruntfile.js so as to completely disable it. Even when I only enabled a single "shard" it still hangs. Please let me know if you need anything else besides the protractor.conf.js file

dborin avatar Aug 04 '14 16:08 dborin

Are you using a grunt adapter?

juliemr avatar Aug 04 '14 17:08 juliemr

Yes grunt protracter runner On Aug 4, 2014 10:40 AM, "Julie Ralph" [email protected] wrote:

Are you using a grunt adapter?

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1130#issuecomment-51091923.

dborin avatar Aug 04 '14 17:08 dborin

I'm guessing that has something to do with it, since your config looks fine to me (except for its lack of a capabilities object, which grunt protractor runner takes care of?). I'm not part of the grunt protractor runner dev team, so I'm not sure exactly how they're generating the config for protractor. Can we open an issue with them?

juliemr avatar Aug 04 '14 18:08 juliemr

Sure, I'll open an issue with them and let you know what they say

On Mon, Aug 4, 2014 at 11:30 AM, Julie Ralph [email protected] wrote:

I'm guessing that has something to do with it, since your config looks fine to me (except for its lack of a capabilities object, which grunt protractor runner takes care of?). Could you open an issue with them?

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1130#issuecomment-51098482.

dborin avatar Aug 04 '14 18:08 dborin

Here's an example of this happening w/o any grunt stuff: https://travis-ci.org/angular/protractor/jobs/31736014

@hankduan can you take a look?

juliemr avatar Aug 05 '14 19:08 juliemr

@juliemr I think your example is different. For your example, protractor reports that the test passed even though it errored. However, it did not hang. For @dborin's problem, protractor actually got stuck and hung. Anyway, your issue is more relevant to https://github.com/angular/protractor/issues/1103 and fixed in https://github.com/angular/protractor/pull/1167.

I'm not sure if https://github.com/angular/protractor/pull/1167 will fix your issue @dborin since I cannot reproduce the hang. Can you check out https://github.com/angular/protractor/pull/1167 and tell me what happens?

hankduan avatar Aug 05 '14 23:08 hankduan

@hankduan it ran fine, but I only ran it two times. I can't load a branch version of Protractor into our Jenkins CI so I'll have to wait until you merge this to master, I'll update our setup accordingly and get back to you if I still see these hangs with sharding re-enabled.

dborin avatar Aug 07 '14 14:08 dborin

@dborin https://github.com/angular/protractor/commit/8f1b4472430ec2d24f102d284e807b073d17ad81 is checked in. Can you try again?

hankduan avatar Aug 20 '14 23:08 hankduan

This should be fixed now.

juliemr avatar Sep 04 '14 20:09 juliemr

I was having this problem.

I think it all started because I didn't understand how to configure for idle-timeout.

https://github.com/angular/protractor/blob/master/docs/timeouts.md says Edit the "idle-duration" key in the capabilities object and while I considered it odd that the key different from SauceLabs docs, I believed, and thus I wasn't successfully overriding the timeouts. So, in order to fix this in Protractor I suspect error handling code that properly accounts for failures that result from these timeouts might need to be accounted for when calculating how many outstanding tests are still not completed.

It would be great if timeouts on tests didn't result in a hung process.

P.S. For the record, Sauce started paying attention when I switched to "idle-timeout" in each of my objects under multiCapabilities.

laurelnaiad avatar Nov 10 '14 20:11 laurelnaiad

fyi : raised https://github.com/teerapap/grunt-protractor-runner/issues/100

Mike-Hardy avatar Dec 17 '14 10:12 Mike-Hardy

i believe this issue needs to be reopened, i am seeing this continuously for our project While running in shrded mode, with maxinstances as 10. All goes fine until we reach the last instance.

Then it is stuck on. [launcher] 1 instance(s) of WebDriver still running

for hours. Is there a way to workaround this? i am using protractor 3.0 and grunt protractor runner 3.0 as well.

amitojduggal avatar Feb 20 '16 13:02 amitojduggal

Can you please post your protractor and your grunt configuration please.

Mike-Hardy avatar Feb 20 '16 21:02 Mike-Hardy

Protractor config:
exports.config = {

    baseUrl: 'https://localhost/app/',
    framework: "jasmine2",
    directConnect: true,
    // run.
    suites: {
        Suite1: 'src/e2e/tests1.js',
        Suite2: 'src/e2e/tests2.js',
        Suite3: 'src/e2e/tests3.js',
        Suite4: 'src/e2e/tests4.js',
        Suite5: 'src/e2e/test5.js',
        Suite6: 'src/e2e/tests6.js',
        Suite7: 'src/e2e/tests7.js',

    },
    allScriptsTimeout: 1200000,
    getPageTimeout: 500000,

    capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {
            'args': ['--disable-extensions', '--incognito', ]
        }
    },

    //
    // See the full list at https://github.com/juliemr/minijasminenode/tree/jasmine1
    jasmineNodeOpts: {
        onComplete: null,
        isVerbose: false,
        showColors: true,
        includeStackTrace: true,
        defaultTimeoutInterval: 1800000,
    },

  };

Grunt config:
protractor: {
            options: {
                keepAlive: false,
                configFile: 'protractor.conf.js'
            },
chrome: {
                options: {
                    keepAlive: false,
                    args: {
                        directConnect: true,
                        capabilities: {
                            'browserName': 'chrome',
                            'shardTestFiles': true,
                            'maxInstances': 4,
                            'chromeOptions': {
                                'args': ['--disable-extensions', '--incognito', ]
                            }
                        }
                    }
                }
            }
}

Basically i use sharding parameter from grunt to override the settings in protractor.conf.js.

The same works fine with firefox all the time, but with chrome , it gets stuck on Launching instance right at the end of the execution, and the CI build has to be halted.

amitojduggal avatar Feb 21 '16 04:02 amitojduggal

Can you try setting all the keepalive settings to true

Mike-Hardy avatar Feb 21 '16 19:02 Mike-Hardy

Thanks for your replies Spikey. i tried by setting keepAlive: true, still hitting the same issue.

seems like a bug in the way protractor handles the webdriver during shrding. Any other workarounds i can try?

amitojduggal avatar Feb 22 '16 03:02 amitojduggal

same here

eyphka avatar Feb 22 '16 07:02 eyphka

Just trying the obvious simple things first. I made sure all my timeout values were the same and made sure that the process running grunt had a timeout greater than the protractor / jasmine timeouts. Try it

Mike-Hardy avatar Feb 22 '16 20:02 Mike-Hardy