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

SymbolBucket.prototype.isEmpty throws TypeErrors on startup #3663

Closed
kristfal opened this issue Nov 18, 2016 · 3 comments · Fixed by #3681
Closed

SymbolBucket.prototype.isEmpty throws TypeErrors on startup #3663

kristfal opened this issue Nov 18, 2016 · 3 comments · Fixed by #3681
Assignees
Labels

Comments

@kristfal
Copy link

kristfal commented Nov 18, 2016

mapbox-gl-js version: Master

SymbolBucket randomly (roughly 1 out of 10 times) throws errors on startup. It is probably a race condition as I've only seen it happen on slower devices (iPhone 5s) which might be triggered by a map resize during map initialization. Everything seems to be working fine when the map is running.

Error:

TypeError: undefined is not an object (evaluating 'this.arrays.icon')

Offending code:

SymbolBucket.prototype.isEmpty = function isEmpty () {
    return this.arrays.icon.isEmpty() &&
        this.arrays.glyph.isEmpty() &&
        this.arrays.collisionBox.isEmpty();
};

The safari inspector is kind enough to not provide stack traces for this error 😢 , I'll keep looking for a proper stack trace.

Expected Behavior

Errors should not be thrown.

Actual Behavior

Errors are thrown.

@elliotleelewis
Copy link

elliotleelewis commented Nov 19, 2016

I get this error a lot since updating I believe to v0.27.0, happens in quick succession too. For instance, I'll get 10-15 errors exactly like that at once. I get this error on all browsers on my 2015 MacBook Pro so don't think its to do with device speed, at least for me.

EDIT:

Here's my Chrome stack trace. Not very useful I know...

Uncaught TypeError: Cannot read property 'icon' of undefined           blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:14

SymbolBucket.isEmpty @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:14
(anonymous function) @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:44
serializeBuckets @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:44
w @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:44
Q @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:44
(anonymous function) @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:44
Actor.receive @ blob:http://localhost/f1f58417-919b-440a-8d2e-9df56730cb1a:96

@ggho
Copy link

ggho commented Nov 21, 2016

I am encountering a similar issue updating from v25.0.1 to v0.27.0 or v0.28.0.

In my case, this error got thrown out after Map#setFilter was called and it does not happen if I don't call Map#setFilter.

For instance, I have a mousemove event listener which handle hover effect on a symbol layer (which would call Map#setFilter when a symbol is being hovered). After a few calls of Map#setFilter (approximately 4 to 5 calls), this error would be thrown consecutively a couple of times (from 4 - 1x times randomly).

Error captured in Chrome:

blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:3309 
Uncaught TypeError: Cannot read property 'icon' of undefined
isEmpty @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:3309
(anonymous function) @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:4872
serializeBuckets @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:4871
done @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:4785
gotDependency @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:4822
(anonymous function) @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:4839
receive @ blob:http://localhost:9001/fcaf0a79-234f-4812-bc7d-237aabb2f995:6711

@Zakay
Copy link

Zakay commented Nov 22, 2016

+1, Same issue here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants