othiym23 / node-continuation-local-storage

implementation of https://github.com/joyent/node/issues/5243
BSD 2-Clause "Simplified" License
1.13k stars 207 forks source link

Importing lib hangs since async-listener 0.5.7 update #61

Closed yangchristian closed 8 years ago

yangchristian commented 8 years ago

Hello there. After the async-listener update that happened a day ago, just requireing or importing continuation-local-storage hangs indefinitely for me now.

I am currently working around this problem by npm shrinkwraping and pegging async-listener to 0.5.6.

Qard commented 8 years ago

What version of node is this happening on?

yangchristian commented 8 years ago

I get the hanging behavior on node 0.10.38 locally and also on our AWS Elastic Beanstalk Node environments which are on 0.12.6.

Qard commented 8 years ago

I just tried both of those locally and they seem to be working fine. Do you have any more info you could share about your environment that you think might matter?

yangchristian commented 8 years ago

Thanks for taking a look. I am trying to setup a minimal repro, hopefully should have that ready soon. In the meantime, here is the our Travis build that started failing after the async-listener update:

https://travis-ci.org/tyranid-org/tyranid/builds/113045966

It was passing a few days ago when async-listener was 0.5.6, then when we reran after 0.5.7 came out it started failing. Our fix in the next build was only to just shrinkwrap async-listener back to 0.5.6.

Wild hunch, but I suspect it might have to do with the fact we are transpiling through Babel and that perhaps the polyfilled Promise implementation isn't working with cls.

holm commented 8 years ago

I spent quite a few hours trying to debug issues after upgrading to 0.5.7. From what I could tell some promises resolved to {returnVal: <obj>, error: false} instead of just <obj> as in 0.5.6. I'm not exactly sure where the problem is, as I really could not figure out how to dig deeper.

Qard commented 8 years ago

@hayes Looks like this is probably related to your recent promise changes. You have any insight on this?

hayes commented 8 years ago

I'll look into it when I get home in a couple hours

On Sat, Mar 5, 2016, 12:10 PM Stephen Belanger notifications@github.com wrote:

@hayes https://github.com/hayes Looks like this is probably related to your recent promise changes. You have any insight on this?

— Reply to this email directly or view it on GitHub https://github.com/othiym23/node-continuation-local-storage/issues/61#issuecomment-192722739 .

hayes commented 8 years ago

I spent a bit of time trying to debug this, but I have not been able to figure out what is causing this. debugging code running through so many layers of abstraction (babel, gulp, mocha, cls) is a real pain. Did you have any luck creating a simpler repro case? Stepping through the failing test in your repo, it looks like internals of something your using is using async iterators. I don't really have the time today to pull all this apart to find the root cause or what is conflicting. It seems likely that it has to do with one of the babel polyfills, but I can't say for sure without a simpler repro example to play with.

yangchristian commented 8 years ago

Thanks guys for taking a look, much appreciated. I haven't quite figured out a simplified repro, so I'm switching my approach to stepping through the failing test. Haven't nailed it down yet, but seems like execution halts when a dependent module is about to resolve a Promise. That module uses babel as well so might be different Promise versions. Will keep looking. Sadly if I can't find anything in next few hours, I might be out of time for next while.

yangchristian commented 8 years ago

Also I just saw othiym23/async-listener#51 (which @hayes is also on) - our failing repo is also on Babel 5.8. Specifically:

  "babel": "^5.8.23",
  "babel-runtime": "^5.8.20"
hayes commented 8 years ago

So I have not been able to reproduce the issue your experiencing, but I did find something that could potentially cause issues. could you try this change https://github.com/hayes/async-listener/commit/7f1d80cde6b8cbcbcd3145f74746cb447685f788 to see if it helps fix your issue?

yangchristian commented 8 years ago

Hi @hayes. Things are working for us with that fix!

hayes commented 8 years ago

@yangchristian have a PR up for the fix, just need to get it reviewed and published

yangchristian commented 8 years ago

Thanks for the quick turnaround! Much appreciated.

Qard commented 8 years ago

Okay, this should be fixed now, and released with async-listener@0.5.8. Let me know if you have any further issues. :smile_cat:

othiym23 commented 8 years ago

I believe this should be addressed by either async-listener@0.5.8 or async-listener@0.6.0, which CLS has now been updated to depend upon. Closing as resolved.