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

(Debug) issues with node past 5.0.0 #3

Open
ccollie opened this issue Apr 3, 2016 · 11 comments
Open

(Debug) issues with node past 5.0.0 #3

ccollie opened this issue Apr 3, 2016 · 11 comments

Comments

@ccollie
Copy link

ccollie commented Apr 3, 2016

First off thanks for the project. It's perfectly suited to untangling dependencies in our medium large app, but i'm experiencing one weird issue.

I can debug (vs code/webstorm) fine with node up to 5.0.0 (the program runs fine regardless). However past 5.0 there is a hang not long after it validates references.

Has anyone had similar issues ?

@analog-nico
Copy link
Owner

I just tested debugging my own production app with WebStorm 11.0.3 and node.js 5.10.0 and am experiencing some issues as well. However, since I am usually using node v4 it may be something different from your issue. In my case node server.js works fine as well. When I use the debugger the boot process doesn't finish. However, fireUp# INFO Validating all inject references done. was already printed and all the modules get loaded / injected to a certain extend - at least the console output of fire-up's activity is complete.

Could you give me more details like some sample code and your exact versions so that I can reproduce your issue?

@ccollie
Copy link
Author

ccollie commented Apr 3, 2016

Wow. Great customer service :-)

I have exactly the same symptoms as you, except in my case I can get it to work with 5.0.0, but no later.
Im using vs-code 0.91/webstorm 2016.1. The code is a bit complicated, since i created a small App class to make things simpler, but based on your description it seems were hitting the same issue.

@analog-nico
Copy link
Owner

:D You are welcome.

I just realized that the boot process is actually working but really slow. 100x slower or so. Could you apply some patience ;) and see if that is the case for you, too?

@ccollie
Copy link
Author

ccollie commented Apr 3, 2016

In webstorm debug startup is slow regardless, which is why i use vs-code to debug (its very fast). But in this case I left vs-code alone for over 10 minutes with no joy.

@analog-nico
Copy link
Owner

Does the boot process finish after some time when using the WebStorm debugger?
Could you pause the debugger is vs-code to see where the app is waiting?

@ccollie
Copy link
Author

ccollie commented Apr 3, 2016

No, it hangs the same in both Webstorm and VsCode. Give me a second - let me fiddle with the debugger a bit.

@ccollie
Copy link
Author

ccollie commented Apr 3, 2016

Spent a couple minutes getting into this, but for now it seems like a Heisenburg. Stepping through causes it to stop at an even earlier point.

@analog-nico
Copy link
Owner

Haha.

I got a little more insight for what at least I see in my system:

  • I updated all of fire-up's dependencies. Did not make a difference. Anyhow, I will publish a newer version of fire-up later today.
  • The slow startup is related to require(...) calls. I can say that it is not related to fire-up. Rather something related to node and the debugger.

If you want to test if your code is hanging at some require(...) call please go to node_modules/fire-up/lib/std/require.js and replace:

  if (_.isFunction(options.require)) {
    return options.require(id);
  } else {
    try {
      return require.main.require(id);
    } catch (e) {
      if (id.charAt(0) !== '/') {
        fireUp.log.debug({}, "The dependency injection wrapper for require uses the main require function which may not always use the search paths you intended.");
        fireUp.log.debug({}, "You may pass your own require function like this: fireUpLib.newInjector({ ..., require: require });");
      }
      throw e;
    }
  }

with:

  if (_.isFunction(options.require)) {
    console.log('  ---> require('+id+')');
    var temp = options.require(id);
    console.log('  <--- require('+id+')');
    return temp;
    //return options.require(id);
  } else {
    try {
      console.log('  ---> require.main.require('+id+')');
      var temp = options.require(id);
      console.log('  <--- require.main.require('+id+')');
      return temp;
      //return require.main.require(id);
    } catch (e) {
      if (id.charAt(0) !== '/') {
        fireUp.log.debug({}, "The dependency injection wrapper for require uses the main require function which may not always use the search paths you intended.");
        fireUp.log.debug({}, "You may pass your own require function like this: fireUpLib.newInjector({ ..., require: require });");
      }
      throw e;
    }
  }

If it prints out ---> and keeps you waiting for the <--- you have the same issue as I do. Let me know what you find out!

@analog-nico
Copy link
Owner

Btw, see develar's comment at the end of nodejs/node-v0.x-archive#9125 Seems like their fix will solve this issue as well.

@analog-nico
Copy link
Owner

FWIW, I just released fire-up@1.0.0. You may try debugging with this version.

@ccollie
Copy link
Author

ccollie commented Apr 4, 2016

Thanks a million. I'll give it a shot.

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

No branches or pull requests

2 participants