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

Occasional infinite loop in previously working code path in 6.5+ #8997

Closed
tgriesser opened this issue Oct 9, 2016 · 5 comments
Closed

Occasional infinite loop in previously working code path in 6.5+ #8997

tgriesser opened this issue Oct 9, 2016 · 5 comments
Labels
v8 engine Issues and PRs related to the V8 dependency.

Comments

@tgriesser
Copy link

  • Version: 6.5+

This is a strange issue I'm having trouble reproducing myself or creating a minimum viable test for, but recently in some CI suites in Node 6.5+ there have been infinite loops occurring in code paths that previously had no issue.

It seems that they're occurring when a method (dynamically named on the prototype) calls another dynamically named method. Instead of calling the correct method, it appears to be instead calling itself resulting in an infinite loop.

For example:

const modifiers = [
  'default', 'defaultsTo', 'defaultTo', 'unsigned',
  'nullable', 'notNull', 'notNullable'
];
each(modifiers, function(method) {
  ColumnBuilder.prototype[method] = function() {
    if (method === 'notNullable') return this.nullable(false);
    this._modifiers[method] = toArray(arguments);
    return this;
  };
});

It seems that at a certain point when the method builder.notNullable() is called instead of then calling/returning this.nullable(false) it instead calls itself again and ends up in an infinite loop.

Seeing as the v8 version was bumped in 6.5 I suspect this might be a bug there, but I'm not sure where to begin researching if that might be the case.

/cc @jamesdixon @fl0w @kirrg001 @ErisDS who reported seeing this issue, as they might be able to provide more info on the platforms they're seeing this on and provide better insight into the problem.

Here's the original issue as it was reported: knex/knex#1725

These are the two code snippets in the codebase where this has been seen to occur:
https://github.com/tgriesser/knex/blob/82685b57f0f61b053a02899941c78ced3e04163d/src/schema/tablebuilder.js#L156-L182
https://github.com/tgriesser/knex/blob/a24e4df6380bfda9b6e2ef05368ac23a0a2ccaab/src/schema/columnbuilder.js#L30-L39

@MylesBorins
Copy link
Contributor

@tgriesser where is that each function you are using above coming from? Do you have the same issue when using modifiers.forEach?

@tgriesser
Copy link
Author

tgriesser commented Oct 9, 2016

It's coming from lodash. Haven't tried with forEach, and actually haven't even been able to reproduce this locally myself yet, once I'm able to I'll give it a shot.

@mscdex mscdex added the v8 engine Issues and PRs related to the V8 dependency. label Oct 9, 2016
@evanlucas
Copy link
Contributor

/cc @nodejs/v8

I tried to reproduce this yesterday and was unable. @tgriesser have you been able to come up with a reproducible test case for this?

@fl0w
Copy link

fl0w commented Oct 11, 2016

I'm trying to reproduce this as well, I've re-run our tests a while now and can't produce this again - though we haven't really done any upgrades.

node v6.7
knex 0.12.0 (with which this originally occurred)

@tgriesser
Copy link
Author

Nope, I haven't been able to reproduce this so I'm closing. I've since split out the offending code path so folks using knex shouldn't see this issue anymore.

This ticket was opened mainly because issue had been reported by a few different users at the same time, so I figured there was a chance it was indicative of a bigger issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests

5 participants