Laika fails to test anything every second time #53

Open
Multiply opened this Issue Aug 24, 2013 · 30 comments

Projects

None yet

5 participants

The first run actually injects the code, so I assumed it can't be it, but then it gets stuck at the loading part. Even if I give it a full minute.

At the second run, it starts up speedily fast, and just runs awesomely, also cleans up.

If I then run it again, it's like in the first try.

Ubuntu version: 12.10
Meteor version: Release 0.6.5
Laika version: 0.2.26

Also, not run with sudo, as I assumed it wouldn't matter.

meteor@multiply:~/repositories/chat$ laika

  injecting laika...
  loading phantomjs...
  loading initial app pool...
^Cmeteor@multiply:~/repositories/chat$ laika

  injecting laika...
  loading phantomjs...
  loading initial app pool...


  Levelling
    ✓ Create User at level 0 (1136ms)


  1 passing (1 seconds)

  cleaning up injected code

meteor@multiply:~/repositories/chat$

Any way I can provide more information than this?

Owner
arunoda commented Aug 24, 2013

can you please run laika with laika -D and show me the output in two situations?

Edit:

A sidenote; I had to install optimist with the -g flag, to even get this far, when it fails. In case it helps?

Failing:

meteor@multiply:~/repositories/chat$ laika -D
[laika log] accepting the following extensions: (js|coffee)

  injecting laika...
  loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ ~/repositories/chat ]]]]]

  loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:24469/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node

[server log]
/home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:184
}).run();
   ^
[server log] Error: ENOENT, no such file or directory '/home/meteor/repositories/chat/.meteor/local/build-garbage-12a3396/programs/server/packages/spark.js'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.readFileSync (fs.js:182:15)
    at mains (/home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:81:19)
    at Array.forEach (native)
    at Function._.each._.forEach (/home/meteor/.meteor/tools/4010e5731d/lib/node_modules/underscore/underscore.js:79:11)
    at /home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:80:5

Success:

^Cmeteor@multiply:~/repositories/chat$ laika -D
[laika log] accepting the following extensions: (js|coffee)

  injecting laika...
  loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ ~/repositories/chat ]]]]]

  loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:17351/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node

[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[server log] laika code injected and listening on: 29002
[server log] LISTENING
[laika log] adding compiler module: coffee-script
[laika log] adding test file: /home/meteor/repositories/chat/tests/levelling.coffee
1..1
[server log] laika code injected and listening on: 18268
[server log] LISTENING
[laika log] start running test
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[laika log] running test
[client log] Oh, so you want to chat?!
[server log] laika code injected and listening on: 29829
[server log] LISTENING
[laika log] test completed
[laika log] closing app
ok 1 Levelling Create User at level 0
# tests 1
# pass 1
# fail 0
  cleaning up injected code

meteor@multiply:~/repositories/chat$
Owner
arunoda commented Aug 24, 2013

very interesting. I've never seen something like this before. Can you
please give me a code to reproduce this locally?

On Sat, Aug 24, 2013 at 2:19 PM, Jens Ulrich Hjuler Pedersen <
notifications@github.com> wrote:

Failing:

meteor@multiply:~/repositories/chat$ laika -D
[laika log] accepting the following extensions: (js|coffee)

injecting laika...
loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ ~/repositories/chat ]]]]]

loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:24469/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node

[server log]
/home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:184
}).run();
^
[server log] Error: ENOENT, no such file or directory '/home/meteor/repositories/chat/.meteor/local/build-garbage-12a3396/programs/server/packages/spark.js'
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at mains (/home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:81:19)
at Array.forEach (native)
at Function..each..forEach (/home/meteor/.meteor/tools/4010e5731d/lib/node_modules/underscore/underscore.js:79:11)
at /home/meteor/repositories/chat/.meteor/local/build/programs/server/boot.js:80:5

Success:

^Cmeteor@multiply:~/repositories/chat$ laika -D
[laika log] accepting the following extensions: (js|coffee)

injecting laika...
loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ ~/repositories/chat ]]]]]

loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:17351/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node

[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[server log] laika code injected and listening on: 29002
[server log] LISTENING
[laika log] adding compiler module: coffee-script
[laika log] adding test file: /home/meteor/repositories/chat/tests/levelling.coffee
1..1
[server log] laika code injected and listening on: 18268
[server log] LISTENING
[laika log] start running test
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[laika log] running test
[client log] Oh, so you want to chat?!
[server log] laika code injected and listening on: 29829
[server log] LISTENING
[laika log] test completed
[laika log] closing app
ok 1 Levelling Create User at level 0

tests 1

pass 1

fail 0

cleaning up injected code

meteor@multiply:~/repositories/chat$


Reply to this email directly or view it on GitHubhttps://github.com/arunoda/laika/issues/53#issuecomment-23205384
.

Arunoda Susiripala

@arunoda http://twitter.com/arunoda
http://gplus.to/arunodahttps://github.com/arunoda
http://www.linkedin.com/in/arunoda

I just created a completely new repository, and added a simple test, nothing in there yet that fails, which is good. All tests go through.

I'll try to add a few packages, and see if anything related pops out. I'll let you know in an edit soon enough.

Edit 1:
Okay, I am not seeing this every second time, it's now and then, but different errors from time to time:

$ laika -D
[laika log] accepting the following extensions: (js|coffee)

  injecting laika...
  loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[app touch log] [[[[[ ~/repositories/laika-2nd-repro ]]]]]

  loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:19669/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[server log]
[server log] /home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:184
[server log] }).run();
[server log]  [server log]  [server log]  [server log] ^[server log]
[server log] Error: ENOENT, no such file or directory '/home/meteor/repositories/laika-2nd-repro/.meteor/local/build-garbage-1t8jsl5/programs/server/packages/meteor.js'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.readFileSync (fs.js:182:15)
    at mains (/home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:81:19)
    at Array.forEach (native)
    at Function._.each._.forEach (/home/meteor/.meteor/tools/4010e5731d/lib/node_modules/underscore/underscore.js:79:11)
    at /home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:80:5

Edit 2:
The optimist error I spoke about earlier.

$ laika -D
[laika log] accepting the following extensions: (js|coffee)

  injecting laika...
  loading phantomjs...
[app touch log]
Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

[[[[[ ~/repositories/laika-2nd-repro ]]]]]

  loading initial app pool...
[app touch log] => Meteor server running on: http://localhost:25306/
[laika log] using nodejs bin(from meteorite): /home/meteor/.meteor/tools/4010e5731d/bin/node
[server log]
[server log] /home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:184
[server log] }).run();
   ^
[server log] Error: Can't find npm module 'optimist'. Did you forget to call 'Npm.depends' in package.js within the 'webapp' package?
    at Object._.each.Npm.require (/home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:104:17)
    at Package (packages/webapp/webapp_server.js:11)
    at packages/webapp.js:588:4
    at packages/webapp.js:599:3
    at mains (/home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:153:10)
    at Array.forEach (native)
    at Function._.each._.forEach (/home/meteor/.meteor/tools/4010e5731d/lib/node_modules/underscore/underscore.js:79:11)
    at /home/meteor/repositories/laika-2nd-repro/.meteor/local/build/programs/server/boot.js:80:5

Edit 3:
Check out https://github.com/Multiply/laika-2nd-repro

Also, as a sidenote; I wasn't sure if this was related to #51 but it seems like it is.

I've done further tests, and it seems it's rarely the same error that happens, but it's usually every second time, for my first repository.

For my test-repo it's every third, or fourth try.

It's different files, that it's missing, but it seems to be the same 3-4 things, such as optimist, .meteor/local/build-garbage-1p4w6yc/programs/server/packages/spark.js and .meteor/local/build/programs/server/boot.js as far as I can see right now.

Owner
arunoda commented Aug 24, 2013

Can you use this laika branch issue-53-fix

How to install it (hope you know it)

  • clone laika repo
  • git checkout issue-53-fix
  • sudo npm install -g

I've tried it, yet it still seems to error-out once in a while.

It works fine for my reproduction-repository, but for my chat-thingy, it fails now and then.
Should I reset something laika-related before testing?

Edit:
Also, is it a factor, if there's a running meteor-application, while running laika from another terminal?

Edit 2:
I tried using your fix, with 10 seconds instead of just 1, and now my chat-thingy works flawlessly too.

Owner
arunoda commented Aug 24, 2013

okay. I need to test this in ubuntu. I tried with mac.
Can you give me day or two?

On Sat, Aug 24, 2013 at 8:44 PM, Jens Ulrich Hjuler Pedersen <
notifications@github.com> wrote:

I've tried it, yet it still seems to error-out once in a while.


Reply to this email directly or view it on GitHubhttps://github.com/arunoda/laika/issues/53#issuecomment-23210387
.

Arunoda Susiripala

@arunoda http://twitter.com/arunoda
http://gplus.to/arunodahttps://github.com/arunoda
http://www.linkedin.com/in/arunoda

Sure, no problem.

I mean, testing works, just not for my automated tests ;)

Edit:
To me it seems like you can't rely on the "Meteor server running on: X", as it's really not running yet. Atleast that's what I could read from the tools/run.js file.

I found an issue over at meteor, which seems like some of the errors I get with laika, so it might not even be laika specific: meteor/meteor#1337

You got around checking it on ubuntu?

Owner
arunoda commented Aug 27, 2013

Yes. had some busy schedule. Will do it today. Anyway, I run laika on travis-ci, which is based on Ubuntu.

I'm quite certain it's NOT a laika issue, and more of a Meteor issue, with the latest version of Meteor.

Owner
arunoda commented Aug 27, 2013

Let's stay in touch with the issue. Let me know if you found a fix.

On Wed, Aug 28, 2013 at 3:06 AM, Jens Ulrich Hjuler Pedersen <
notifications@github.com> wrote:

I'm quite certain it's NOT a laika issue, and more of a Meteor issue, with
the latest version of Meteor.


Reply to this email directly or view it on GitHubhttps://github.com/arunoda/laika/issues/53#issuecomment-23372977
.

Arunoda Susiripala

@arunoda http://twitter.com/arunoda
http://gplus.to/arunodahttps://github.com/arunoda
http://www.linkedin.com/in/arunoda

Just a quick observation, @arunoda - Look at my latest comment meteor/meteor#1337 (comment)

sbking commented Sep 19, 2013

I haven't had any issues with the recent versions of Meteor, but as soon as I installed Laika I'm getting these same errors. I'm pretty sure the issue isn't with Meteor itself.

This is indeed a Meteor issue.

I think it's because I ran Meteor in a seperate process, while laika in the same directory at the same time.
Laika adds/removes files, ie. causing the actual Meteor process to rebuild, because it syncs the files.

sbking commented Sep 19, 2013

Oh, that makes sense. But why does laika fail every other time? For me, since I stopped the separate meteor process, it is failing exactly every other time, doesn't seem intermittent at all.

First laika injects the code, and the other Meteor app rebuilds. Laika fails.

Next time, it's already injected, and thus, no file changes occurs. Then it works. Cleans up.

Third time, it injects the code... causing a rebuild, and so on.

Edit:
I saw the same, but I had lingering Meteor stuff running. After a complete kill of the app, laika worked every time.

Everytime i kill all instances of node, laika runs successfully.

killall -9 node

Maybe this will help resolve the problem.

Owner
arunoda commented Oct 6, 2013

There are some issue with zombie node processes stay alone after the tests exists. This happens possibly with errors. Once a error happens, doing a killall or pkill is really could solve these issues.

I'll try to improve some better way to cleanup injected files too.
And its better run close actual meteor app, while laika is running.

Owner
arunoda commented Oct 6, 2013

Use new laika version v0.2.27 It does graceful shutdown and removes injected code even with CTRL + C

@arunoda I updated to v0.3.0 and I can confirm, i don't have those problems anymore. The command runs just fine each time. Thanks for the fix!

Owner
arunoda commented Oct 6, 2013

awesome.

@arunoda I spoke too early. Now i do occasionally get this error:

 Error: connect ECONNREFUSED
      at errnoException (net.js:901:11)
      at Object.afterConnect [as oncomplete] (net.js:892:19)
Owner
arunoda commented Oct 6, 2013

Yes. This is a historic bug, which relates to when talking with server.
Anyway, make sure you stop your app while running laika.

On Sun, Oct 6, 2013 at 9:24 AM, Ramsey notifications@github.com wrote:

@arunoda https://github.com/arunoda I spoke too early. Now i do
occasionally get this error:

Error: connect ECONNREFUSED
at errnoException (net.js:901:11)
at Object.afterConnect as oncomplete


Reply to this email directly or view it on GitHubhttps://github.com/arunoda/laika/issues/53#issuecomment-25761878
.

Arunoda Susiripala

@arunoda http://twitter.com/arunoda
http://gplus.to/arunodahttps://github.com/arunoda
http://www.linkedin.com/in/arunoda

Sounds, good. Thanks again for all your help and hard work.

Multiply commented Oct 6, 2013

Could you add an option, so laika won't run, if meteor is already running?
Or if laika itself is running, it won't re-run?

My solution, was to simply do CI in a different folder, using symlinks, and in some projects, simply cp -R the needed files.

i am running in to very similar issues with laika 0.3.2 and meteor 0.7.0. The behavior is very inconsistent and I am struggling with identifying the exact source of the problems

the error i am getting is as follows:

Error: ENOENT, no such file or directory
at Argv (/Users/callmephilip/.meteor/tools/09b63f1ed5/lib/node_modules/optimist/index.js:23:29)
at Object.main (packages/webapp/webapp_server.js:510)
at /Users/callmephilip/projects/onair/.meteor/local/build/programs/server/boot.js:182:27

Inspecting file system after the running the tests shows that the file does exist

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