browserstack / browserstack-local-nodejs

NodeJS bindings for BrowserStack Local
https://www.browserstack.com
MIT License
71 stars 56 forks source link

Error: spawn ETXTBSY #19

Closed lukewaite closed 7 years ago

lukewaite commented 8 years ago

I'm getting the following error when attempting to use this extension in CI.

Error: spawn ETXTBSY
    at exports._errnoException (util.js:893:11)
    at ChildProcess.spawn (internal/child_process.js:302:11)
    at exports.spawn (child_process.js:367:9)
    at Object.exports.execFile (child_process.js:139:15)
    at /builds/intouch-capture/app/node_modules/browserstack-local/lib/Local.js:31:34
    at /builds/intouch-capture/app/node_modules/browserstack-local/lib/LocalBinary.js:44:11
    at FSReqWrap.oncomplete (fs.js:82:15)

Is this possibly a race condition where the Binary is being executed while it is being moved into place?

ChrisZieba commented 7 years ago

Also seeing this issue

eljefedelrodeodeljefe commented 7 years ago

dito

ngsankha commented 7 years ago

Are you on a Linux VM hosted on a Windows machine via Vagrant or something similar?

lukewaite commented 7 years ago

I'm inside a docker container running on Ubuntu 16.04.

eljefedelrodeodeljefe commented 7 years ago

For me it is a CircleCI machine.

ChrisZieba commented 7 years ago

@sankha93

This is the circle.yaml file I'm using, the container is running Ubuntu 14.04.

machine:
  node:
    version: 6.1.0
  services:
    - redis

dependencies:
  cache_directories:
     - mongodb-linux-x86_64-3.2.8
  pre:
    - if [[ ! -d mongodb-linux-x86_64-3.2.8 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.2.8.tgz && tar xvzf mongodb-linux-x86_64-3.2.8.tgz; fi
    - sudo /etc/init.d/mongod stop
    - sudo cp mongodb-linux-x86_64-3.2.8/bin/* /usr/bin
    - sudo /etc/init.d/mongod start

test:
  override:
    - NODE_ENV=test ./node_modules/cucumber/bin/cucumber.js ./client/test/features/hello-localize.feature

Here is the test it is running:

'use strict';

const assert = require('cucumber-assert');
const config = require('config');
require('selenium-webdriver');

module.exports = function() {

  this.When(/^I open the homepage$/, function(next) {
    this.driver.get(`http://localhost:${config.ports.web}`);
    next();
  });

  this.Then(/^I should see "([^"]*)"$/, function(sourceMatch, next) {
    this.driver.getPageSource()
      .then(function(source) {
        assert.equal(source.indexOf(sourceMatch) > -1, true, next, 'Expected source to contain ' + sourceMatch);
      });
  });
};

and the feature file

Feature: Homepage testing

Scenario: Can check the homepage
When I open the homepage
Then I should see "Ready for the world?"
Shilpi3 commented 7 years ago

I am also getting the same error. I have tried installing browserstack-local globally. Any updates??

vedharish commented 7 years ago

During the download, the bindings used to pipe the response to the file and proceed on the response end event. This might have a race condition when the response finished but the filestream was still being written to. Changed this to process on close event for the filestream.

Also added retries if the binary execution failed. So, this issue should not happen again and if it does, the binary should automatically retry download. Please reopen this issue if you still face this still.