acuminous / yadda

A BDD javascript library
412 stars 73 forks source link

Seg fault in nodejs #170

Closed cmdln closed 9 years ago

cmdln commented 9 years ago

You ready for a fun one? We are pulling yadda into our second project. The first project used in with Karma and Mocha for in browser tests. It works well and we are growing our suite rapidly.

I just did the early leg work to start building acceptance tests for the companion node project, using just mocha along with yadda and webdriverio. Our first scenario and feature worked beautifully so I gave the green light to our QE team to start expanding on my initial work.

Our second feature and scenario generates a segfault. Every time. One of our QE folks thinks he has narrowed it down to the Levenshtein distance calculation in the scoring engine.

https://github.com/acuminous/yadda/blob/master/lib/LevenshteinDistanceScore.js#L61

I suspect a resource issue based on our nodejs config, maybe a stack size limit per process or it is possible that long lines of text in the step descriptions is pushing this cartesian product beyond what nodejs can easily handle.

cmdln commented 9 years ago

I will work on the environment side, to see if there is something I can tweak with nodejs to alleviate this. In the meantime, none of our suite relies on the fuzzy matching so if there is a way to disable the distance calculation or one can simply be added, that would also give us a workaround for node based tests.

cmdln commented 9 years ago

These may be worth considering if an approximate is acceptable in place of an accurate distance calculation.

http://stackoverflow.com/a/4057585

cressie176 commented 9 years ago

It's a known bug with node. Arround 0.10.35 I think. I can dig out the their bug number in a bit. If you update you should be fine (unless they have regressed)

cmdln commented 9 years ago

Ah, yeah, we are stuck on 0.10.3x--let me see what the latest in that series is and if we can reproduce with that. That matches what digging I have been doing since opening this. I'll confirm in the next little bit so you can close this--thanks for the fast reply!

cressie176 commented 9 years ago

Was fixed in the next patch release of node so if you are worried about upgrading you only need to move up one version.

Worth doing as it doesn't affect just Yadda but any potentially any code with nested for loops (as in levenstein distance code)

cmdln commented 9 years ago

Yeah, this is definitely the issue. Our nodenv was set to just v0.10, which must pin to something stupid like v0.10.0. I changed that explicitly to v0.10.38 which I think is the current for that release and I am on my 3rd run with no problems. Feel free to close and thanks for both your help and your patience.

cressie176 commented 9 years ago

Here is the node bug report. It affected 0.10.31 not 0.10.35 as I previously stated.