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 recursion in Request.Queue #1204

Open
murrellr opened this issue Jul 19, 2013 · 2 comments
Open

Infinite recursion in Request.Queue #1204

murrellr opened this issue Jul 19, 2013 · 2 comments

Comments

@murrellr
Copy link

I have an issue where Google Chrome reports "Maximum call stack size exceeded". First, some details:

Google Chrome version 28.0.1500.72 m
MooTools version 1.3

We are in the process of updating our product to the latest MooTools, but are preparing a minor release before we update. When this happens, we are making a GET request for a file and the request fails for some reason. If our device is very busy and the request is for a large file, the request fails and the request get stuck in an infinite recursion: a failure event is fired, which eventually calls send, which fails and fires a failure event, and so on.

Because we are so close to a release, we can't update to the latest MooTools. I need to know how this situation can happen and how to work around the problem.

Uncaught RangeError: Maximum call stack size exceeded. mootools.js:5238
Request.Request.Class.send mootools.js:5238
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onStateChange mootools.js:5120
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:939
Request.Request.Class.send mootools.js:5252
wrapper.extend.$owner mootools.js:1635
send mootools.js:9427
(anonymous function) mootools.js:13259
(anonymous function) mootools.js:939
Request.Queue.Class.runNext mootools.js:13287
wrapper.extend.$owner mootools.js:1635
Request.Queue.onComplete rundown.js:120
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Queue.Class.onComplete mootools.js:13331
wrapper.extend.$owner mootools.js:1635
(anonymous function) mootools.js:13222
(anonymous function) mootools.js:939
(anonymous function) mootools.js:1757
(anonymous function) mootools.js:215
Array.implement.each mootools.js:330
Events.Class.fireEvent mootools.js:1755
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.onFailure mootools.js:5150
wrapper.extend.$owner mootools.js:1635
Request.Request.Class.failure mootools.js:5146
wrapper.extend.$owner mootools.js:1635

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@murrellr
Copy link
Author

I have been doing more investigation on this problem. When it happens, the XMLHttpRequest onreadystatechange event is fired almost immediately after the send() request. readyState is 4, status is zero, and statusText is "". I'm guessing that for normal operation, onreadystatechange event is called some time after send() has returned. In this error case, it looks like onreadystatechange is called immediately from the send() call, which causes an infinite recursion. The current request has not been dequeued yet, so it is recalled during the onreadystatechange event.

One other condition to note, m OS is Windows 7.

@murrellr murrellr reopened this Jul 23, 2013
@murrellr
Copy link
Author

I resolved the problem by changing this:

    var q = function(){
        this.requests[name]._groupSend(options);
        this.queue.erase(q);
    }.bind(this);

to this:

    var q = function(){
        this.queue.erase(q);
        this.requests[name]._groupSend(options);
    }.bind(this);

I do not know enough about the internals of MooTools to assess the impact of this change, but it seems to work in our application. This problem exists in the latest version.

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