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

Infinite loop with promises (since 7.1.0) #217

Open
mjl opened this issue Apr 21, 2017 · 0 comments
Open

Infinite loop with promises (since 7.1.0) #217

mjl opened this issue Apr 21, 2017 · 0 comments

Comments

@mjl
Copy link

mjl commented Apr 21, 2017

I have stumbled on an infinite loop problem when dealing with promises.

I have been able to reduce the problem to the following couple of lines (copypasted from Chrome console). My angular app does an ajax request, then stores it in a redux store, something like this:

>> temp1
l {object_count: 6666, objects: Array(20), object_list_truncated: 20, seq: 1, $promise: f…}
>> i = Immutable({})
Object {merge: function, replace: function, without: function, asMutable: function, set: function…}
>> ii = i.set("result", temp1)
Object {result: Object, merge: function, replace: function, without: function, asMutable: function…}
>> ii.result <--- ** HANGS, consumes 100% cpu, must be killed in task manager **

However, if I clear out the $promise property first:

>> temp1.$promise = null
null
>> temp1
l {object_count: 41, objects: Array(20), object_list_truncated: 20, seq: 1, $promise: null…}
>> i = Immutable({})
Object {merge: function, replace: function, without: function, asMutable: function, set: function…}
>> ii = i.set("result", temp1)
Object {result: Object, merge: function, replace: function, without: function, asMutable: function…}
>> ii.result
Object {object_count: 41, objects: Array(20), object_list_truncated: 20, seq: 1, $promise: null…}

everything works fine as expected.

I guess something breaks when immutabling (is that even a word?) promises, and that leads to an infinite loop when touching the object later. Also, this is an angular $q object which might be slightly different to a stock Promise.

This seems to have appeared with 7.1.0, possibly 7.1.1, but it worked fine with 7.0.0. It might be related to pull #194 which happened in that time frame.

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

1 participant