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

'instanceIndex is out of range' Error #7153

Closed
njrivera opened this issue Oct 16, 2018 · 3 comments
Closed

'instanceIndex is out of range' Error #7153

njrivera opened this issue Oct 16, 2018 · 3 comments

Comments

@njrivera
Copy link
Contributor

njrivera commented Oct 16, 2018

I'm periodically (consistently with a particular action) getting the instanceIndex is out of range described in this issue: #4983

After a bunch of debugging I've been able to reproduce the error in the 2 sandcastle examples given below. These are almost identical to the code in this comment on the 4983 issue -> #4983 (comment).
It seems that the fix that closed the issue did fix this for the situation in that code, but not for the situation in which multiple modifications to a line are being made before the line is removed.

The first sandcastle example is without requestRenderMode and always gives an error when clicking the Change Polylines button, and the second example only gives an error when you click it quickly while cesium is still loading everything OR if you click it more than once. I chose to put the second example there because in the actual codebase I'm using, requestRenderMode is used.

I don't mind working on this, but the code can be confusing. I've gotten as far as eliminating the the instanceIndex error, but I'm not sure if this is the best way to go about it (the code below). Also, I thought I found bug using this earlier, but for now I can't reproduce it. I'll keep testing this to see if I can reproduce it. The error had to do with trying to update a polyline that had already been destroyed.

I put this in there because duplicates were constantly being added to _polylinesToUpdate. Depending on how long I wait with nothing happening and no rendering for a while I can have 1 line thousands of times in that list.

PolylineCollection.prototype._updatePolyline = function(polyline, propertyChanged) {
    // *** CODE I ADDED
    if (this._polylinesToUpdate[polyline._index] && this._polylinesToUpdate[polyline._index] === polyline) {
        return;
    }
    // ***

    this._polylinesUpdated = true;
    this._polylinesToUpdate.push(polyline);
    ++this._propertiesChanged[propertyChanged];
};

Sandcastle example: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=tVNNj9MwEP0ro1yaSqmjpSyVaFrBZvdWBGILF7IHrzNtLBw7sp1UYbX/HeezaRE3sBLFHs97M+/ZqaiGiuMJNWxA4gliNLzMyfc25s9Yu4yVtJRL1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eeF0pbKLXwCQkt5oVwZprwuWQ/0RJm2r8jCgdQlPIKeLpJvKufNPGACWqM2zmUQjzyX5h42yh0+RcwoWjK5fFzhVrQuknJbra7LkgIiUK3/BNluxOZMP4G

Browser: Chrome, FF, IE

Operating System: Windows 10

@njrivera njrivera changed the title instanceIndex Error 'instanceIndex is out of range' Error Oct 16, 2018
@hpinkos
Copy link
Contributor

hpinkos commented Oct 16, 2018

Wow, thank you so much for the detailed issue write up and code example @njrivera! This is incredibly helpful for us for fixing the issue.

I opened this PR, which has a similar fix to the one you proposed #7155
We should be able to get this merged in time for the next release . Thanks again!

@hpinkos
Copy link
Contributor

hpinkos commented Oct 22, 2018

Thanks again for reporting this @njrivera! I had seen this crash pop up occasionally but I could never figure out a way to reproduce it. Your test case helped a lot. A fix for this has been merged and will be included in the 1.51 release available on November 1st

@njrivera
Copy link
Contributor Author

njrivera commented Oct 22, 2018 via email

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

2 participants