Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

mock server failing to start #2

Closed
travi opened this issue Apr 27, 2016 · 8 comments
Closed

mock server failing to start #2

travi opened this issue Apr 27, 2016 · 8 comments

Comments

@travi
Copy link

travi commented Apr 27, 2016

I've been trying to follow along with your progress, but I'm having trouble getting things to execute successfully with the latest master. Upon running grunt --verbose pact, I'm seeing the following:

Running "pact" task

Running "pact:default" (pact) task
Verifying property pact.default exists in config...OK
Files: test/service-contracts/travi-api.pact.js
Options: dir="tmp/pacts", log="log.txt", spec=2, consumer="travi.org-admin", provider="travi-api"
{"name":"pact-node","hostname":"Travi-MBP.local","pid":41559,"level":40,"msg":"Pact exited with code 1.","time":"2016-04-27T04:21:46.841Z","v":0}
Fatal error: kill ESRCH

and

node.js:748
        throw errnoException(err, 'kill');
        ^

Error: kill ESRCH
  at exports._errnoException (util.js:890:11)
  at process.kill (node.js:748:15)
  at Server.stop (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:177:12)
  at Server.delete (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:188:14)
  at /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/pact.js:41:23
  at Function._.map._.collect (/Users/admin/development/travi.org-admin/node_modules/underscore/underscore.js:172:24)
  at process.removeAll (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/pact.js:40:17)
  at process.g (events.js:273:16)
  at emitOne (events.js:95:20)
  at process.emit (events.js:182:7)
  at process.exit (node.js:721:17)
  at process.<anonymous> (/Users/admin/development/travi.org-admin/node_modules/time-grunt/index.js:173:11)
  at process.g (events.js:273:16)
  at emitOne (events.js:90:13)
  at process.emit (events.js:182:7)
  at process.exit (/Users/admin/development/travi.org-admin/node_modules/time-grunt/index.js:43:11)
  at tryToExit (/Users/admin/development/travi.org-admin/node_modules/exit/lib/exit.js:17:15)
  at Object.exit (/Users/admin/development/travi.org-admin/node_modules/exit/lib/exit.js:34:3)
  at Object.fail.fatal (/Users/admin/development/travi.org-admin/node_modules/grunt/lib/grunt/fail.js:48:14)
  at process.uncaughtHandler (/Users/admin/development/travi.org-admin/node_modules/grunt/lib/grunt.js:121:10)
  at emitOne (events.js:90:13)
  at process.emit (events.js:182:7)
  at process._fatalException (node.js:264:26)

My task config (I use load-grunt-config, so this config is located in grunt/pact.yml):

options:
  dir: tmp/pacts
  log: log.txt
  spec: 2
  consumer: travi.org-admin
  provider: travi-api

default:
  src: test/service-contracts/**/*.pact.js
$ node --version
v5.9.1

$ ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]

I see that your travis build is passing, and I confirmed that npm test also passes when I run it locally. I'm not sure what to check next, but wanted to at least report the issue in case it would help identify something if it is related to the project.

@mboudreau
Copy link
Contributor

How are you loading up the dependency? I'm worried that you're mentioning using the 'master', when you shouldn't be using git to include node project dependencies, but instead use npm.

If you did use NPM, you should have a 'pact' executable under your node_modules/.bin/, just try to run it to see if that works. You don't need ruby anymore since Pact is now using a portable version of ruby within it's executable. I've also seen this before when the pact scripts running die because of an error, and that makes pact try to exit but it hasn't finished instantiating yet, causing this error. I might have to investigate this further. In the meantime, just try to remove your 'src' property and see if that runs. If it does, I recommend you try to go file by file using node to run your script to see if any issues arise.

Please let me know of the outcome cause I need to wrap this if this is the case. Cheers.

@travi
Copy link
Author

travi commented Apr 27, 2016

I'm pulling your master version through npm as "@pact-foundation/grunt-pact": "pact-foundation/grunt-pact#master" since the new functionality hasn't been published as an npm release yet (which seems to early at this point, maybe). This pulls in version dd35f48f89f517cad9d38c0d0d178d55e107275d, the latest commit.

Removing the src property gives me the following error:

$ grunt pact
Running "pact:default" (pact) task
Verifying property pact.default exists in config...ERROR
>> Unable to process task.
Warning: Required config property "pact.default" missing. Use --force to continue.

I currently only have one script, with nothing more than a console.log in it, to try to debug this issue.

Running the pact executable directly gives me:

$ node_modules/.bin/pact
{"name":"pact-node","hostname":"Travi-MBP.local","pid":42191,"level":40,"msg":"Pact exited with code 1.","time":"2016-04-27T13:26:48.000Z","v":0}
node.js:748
        throw errnoException(err, 'kill');
        ^

Error: kill ESRCH
    at exports._errnoException (util.js:890:11)
    at process.kill (node.js:748:15)
    at Server.stop (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:177:12)
    at Server.<anonymous> (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:135:8)
    at ChildProcess.g (events.js:273:16)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:90:13)

I have gone as far as blowing away node_modules completely and reinstalling, so it shouldn't be related to any old dependency.

@mboudreau
Copy link
Contributor

Hm, okay. I have never tried to install it via github and I'm not sure if
the postinstall actually runs in that instance, but I'm guessing that it
should. Just to be sure, you should be able to run this executable
node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-win32/bin/pact-mock-service.bat
(this is assuming you have windows). Please try to run it to see if it
works. If it doesn't, please check to make sure the folder is there, if
not, there's either an installation issue when you first get the package
from github, or that a newer version of windows might not work with
pact-mock-service.

Please let me know how you go so I can add better tests around your use
case. Cheers.

On Wed, Apr 27, 2016 at 11:30 PM Matt Travi notifications@github.com
wrote:

I'm pulling your master version through npm as "@pact-foundation/grunt-pact":
"pact-foundation/grunt-pact#master" since the new functionality hasn't
been published as an npm release yet (which seems to early at this point,
maybe). This pulls in version dd35f48,
the latest commit.

Removing the src property gives me the following error:

$ grunt pact
Running "pact:default" (pact) task
Verifying property pact.default exists in config...ERROR

Unable to process task.
Warning: Required config property "pact.default" missing. Use --force to continue.

I currently only have one script, with nothing more than a console.log in
it, to try to debug this issue.

Running the pact executable directly gives me:

$ node_modules/.bin/pact
{"name":"pact-node","hostname":"Travi-MBP.local","pid":42191,"level":40,"msg":"Pact exited with code 1.","time":"2016-04-27T13:26:48.000Z","v":0}
node.js:748
throw errnoException(err, 'kill');
^

Error: kill ESRCH
at exports._errnoException (util.js:890:11)
at process.kill (node.js:748:15)
at Server.stop (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:177:12)
at Server. (/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/src/server.js:135:8)
at ChildProcess.g (events.js:273:16)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket. (internal/child_process.js:323:11)
at emitOne (events.js:90:13)

I have gone as far as blowing away node_modules completely and
reinstalling, so it shouldn't be related to any old dependency.


You are receiving this because you commented.

Reply to this email directly or view it on GitHub
#2 (comment)

@travi
Copy link
Author

travi commented Apr 28, 2016

I'm on OSX, so the .bat file obviously won't execute, but it does exist and is marked as executable. if I execute:

$ ./node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/bin/pact-mock-service 

I get the following error:

/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:478:in `ruby': Your Ruby version is 2.1.5, but your Gemfile requires 2.2.4 (Gem::RubyVersionMismatch)
    from /Users/admin/development/travi.org-admin/Gemfile:2:in `load'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:in `instance_eval'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:in `load'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set.rb:232:in `load_gemdeps'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1031:in `use_gemdeps'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1216:in `<top (required)>'
    from <internal:gem_prelude>:1:in `require'
    from <internal:gem_prelude>:1:in `<compiled>'

Would I be correct to assume that the bundled version is 2.1.5? I currently have the following line in my project's Gemfile: ruby "2.2.4" as well as a .ruby-version with 2.2.4 as its contents, so rbenv takes care of setting my ruby version for me.

If I remove both the .ruby-version and the Gemfile and switch to ruby 2.1.5, I get the following:

$ ./node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/bin/pact-mock-service 
No entry for terminal type "xterm-256color";
using dumb terminal settings.
[2016-04-27 21:56:22] INFO  WEBrick 1.3.1
[2016-04-27 21:56:22] INFO  ruby 2.1.5 (2014-11-13) [x86_64-darwin13.0]
[2016-04-27 21:56:22] INFO  WEBrick::HTTPServer#start: pid=84053 port=59955

and $ grunt pact then works.

Does this mean that I'm limited to using ruby version 2.1.5 for my project because of this dependency?

@mboudreau
Copy link
Contributor

hm, interesting. Thanks for getting back to me on this. the
pact-mock-service is suppose to be bundled with what's called 'portable
ruby', where the ruby version is packaged within the executable so that it
doesn't have external dependencies. It seems like a bug on how we've
packaged it for OSX that I haven't seen before. I'm guessing there's
something still referencing ruby somewhere where it shouldn't. I'll create
a bug on the pact-mock-service project and see if we can fix it.

On Thu, Apr 28, 2016 at 1:02 PM Matt Travi notifications@github.com wrote:

I'm on OSX, so the .bat file obviously won't execute, but it does exist
and is marked as executable. if I execute:

$ ./node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/bin/pact-mock-service

I get the following error:

/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:478:in ruby': Your Ruby version is 2.1.5, but your Gemfile requires 2.2.4 (Gem::RubyVersionMismatch) from /Users/admin/development/travi.org-admin/Gemfile:2:inload'
from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:in instance_eval' from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:inload'
from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set.rb:232:in load_gemdeps' from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1031:inuse_gemdeps'
from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1216:in <top (required)>' from <internal:gem_prelude>:1:inrequire'
from internal:gem_prelude:1:in `'

Would I be correct to assume that the bundled version is 2.1.5? I
currently have the following line in my project's Gemfile: ruby "2.2.4"
as well as a .ruby-version with 2.2.4 as its contents, so rbenv takes
care of setting my ruby version for me.

If I remove both the .ruby-version and the Gemfile and switch to ruby
2.1.5, I get the following:

$ ./node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/bin/pact-mock-service
No entry for terminal type "xterm-256color";
using dumb terminal settings.
[2016-04-27 21:56:22] INFO WEBrick 1.3.1
[2016-04-27 21:56:22] INFO ruby 2.1.5 (2014-11-13) [x86_64-darwin13.0]
[2016-04-27 21:56:22] INFO WEBrick::HTTPServer#start: pid=84053 port=59955

and $ grunt pact then works.

Does this mean that I'm limited to using ruby version 2.1.5 for my
project because of this dependency?


You are receiving this because you commented.

Reply to this email directly or view it on GitHub
#2 (comment)

@travi
Copy link
Author

travi commented Apr 28, 2016

Cool, if it can be resolved without forcing me to adjust my project to a specific ruby version, that would obviously be preferred. I'm happy to help test things out if you are abe to find a possible solution.

Thanks for looking into this and for your work moving this project forward.

@mboudreau
Copy link
Contributor

Yeah, definitely.

No problem. Just wait for what I have in store in the future ;)

On Thu, Apr 28, 2016 at 1:41 PM Matt Travi notifications@github.com wrote:

Cool, if it can be resolved without forcing me to adjust my project to a
specific ruby version, that would obviously be preferred. I'm happy to help
test things out if you are abe to find a possible solution.

Thanks for looking into this and for your work moving this project forward.


You are receiving this because you commented.

Reply to this email directly or view it on GitHub
#2 (comment)

@mboudreau
Copy link
Contributor

@travi I've created a new ticket on the right repo, please direct all your comments and findings there as I'll close this one. Cheers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants