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

Crash clustering an empty feature collection #6

Closed
1ec5 opened this issue Jan 16, 2017 · 2 comments
Closed

Crash clustering an empty feature collection #6

1ec5 opened this issue Jan 16, 2017 · 2 comments
Labels

Comments

@1ec5
Copy link

1ec5 commented Jan 16, 2017

Clustering an empty feature collection leads to a crash in kdbush:

Thread 1Queue : com.apple.main-thread (serial)
#0	0x00000001055dd7da in void kdbush::KDBush<mapbox::supercluster::Cluster, unsigned int>::select<(unsigned char)0>(unsigned int, unsigned int, unsigned int) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/kdbush/0.1.1/include/kdbush.hpp:176
#1	0x00000001055dc131 in kdbush::KDBush<mapbox::supercluster::Cluster, unsigned int>::sortKD(unsigned int, unsigned int, unsigned char) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/kdbush/0.1.1/include/kdbush.hpp:154
#2	0x00000001055dbf5c in void kdbush::KDBush<mapbox::supercluster::Cluster, unsigned int>::fill<std::__1::__wrap_iter<mapbox::supercluster::Cluster const*> >(std::__1::__wrap_iter<mapbox::supercluster::Cluster const*> const&, std::__1::__wrap_iter<mapbox::supercluster::Cluster const*> const&) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/kdbush/0.1.1/include/kdbush.hpp:63
#3	0x00000001055da958 in kdbush::KDBush<mapbox::supercluster::Cluster, unsigned int>::fill(std::__1::vector<mapbox::supercluster::Cluster, std::__1::allocator<mapbox::supercluster::Cluster> > const&) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/kdbush/0.1.1/include/kdbush.hpp:46
#4	0x00000001055da5de in mapbox::supercluster::Supercluster::Zoom::Zoom(mapbox::geometry::feature_collection<double, std::__1::vector> const&) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/supercluster/0.2.0/include/supercluster.hpp:167
#5	0x00000001055da03d in mapbox::supercluster::Supercluster::Zoom::Zoom(mapbox::geometry::feature_collection<double, std::__1::vector> const&) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/supercluster/0.2.0/include/supercluster.hpp:159
#6	0x00000001055d8f9f in std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>::pair<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&, void>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:318
#7	0x00000001055d8f7a in std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>::pair<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&, void>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:319
#8	0x00000001055d8f66 in void std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> >::construct<std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>, int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>*, int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1740
#9	0x00000001055d8f39 in void std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> > >::__construct<std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>, int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(std::__1::integral_constant<bool, true>, std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> >&, std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>*, int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1656
#10	0x00000001055d8ef9 in void std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> > >::construct<std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>, int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> >&, std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom>*, int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1502
#11	0x00000001055d8eb6 in std::__1::unique_ptr<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*>, std::__1::__hash_node_destructor<std::__1::allocator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*> > > > std::__1::__hash_table<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::__unordered_map_hasher<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::hash<unsigned char>, true>, std::__1::__unordered_map_equal<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::equal_to<unsigned char>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom> > >::__construct_node<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:2259
#12	0x00000001055d7cfa in std::__1::pair<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*>*>, bool> std::__1::__hash_table<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::__unordered_map_hasher<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::hash<unsigned char>, true>, std::__1::__unordered_map_equal<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::equal_to<unsigned char>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom> > >::__emplace_unique_impl<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:2046
#13	0x00000001055d7cb4 in std::__1::pair<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*>*>, bool> std::__1::__hash_table<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::__unordered_map_hasher<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::hash<unsigned char>, true>, std::__1::__unordered_map_equal<unsigned char, std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, std::__1::equal_to<unsigned char>, true>, std::__1::allocator<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom> > >::__emplace_unique<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:1078
#14	0x00000001055d7c7c in std::__1::pair<std::__1::__hash_map_iterator<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<unsigned char, mapbox::supercluster::Supercluster::Zoom>, void*>*> >, bool> std::__1::unordered_map<unsigned char, mapbox::supercluster::Supercluster::Zoom, std::__1::hash<unsigned char>, std::__1::equal_to<unsigned char>, std::__1::allocator<std::__1::pair<unsigned char const, mapbox::supercluster::Supercluster::Zoom> > >::emplace<int, mapbox::geometry::feature_collection<double, std::__1::vector> const&>(int&&, mapbox::geometry::feature_collection<double, std::__1::vector> const&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:916
#15	0x00000001055d7c44 in mapbox::supercluster::Supercluster::Supercluster(mapbox::geometry::feature_collection<double, std::__1::vector> const&, mapbox::supercluster::Options) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/supercluster/0.2.0/include/supercluster.hpp:96
#16	0x00000001055d7908 in mapbox::supercluster::Supercluster::Supercluster(mapbox::geometry::feature_collection<double, std::__1::vector> const&, mapbox::supercluster::Options) at /Users/mxn/hub/mapbox-gl-native-2/mason_packages/headers/supercluster/0.2.0/include/supercluster.hpp:90
#17	0x0000000105593471 in std::__1::__unique_if<mapbox::supercluster::Supercluster>::__unique_single std::__1::make_unique<mapbox::supercluster::Supercluster, mapbox::geometry::feature_collection<double, std::__1::vector> const&, mapbox::supercluster::Options&>(mapbox::geometry::feature_collection<double, std::__1::vector> const&&&, mapbox::supercluster::Options&&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3141

/ref mapbox/mapbox-gl-native#7622 (comment)
/cc @mourner @jfirebaugh

@1ec5 1ec5 added the bug label Jan 16, 2017
jfirebaugh referenced this issue in mapbox/mapbox-gl-native Jan 16, 2017
Ignore empty feature collections or non–feature collections for the purposes of clustering or tiling. A source’s clustering option can only be set when the source is constructed, but setGeoJSON() enables the developer to swap a clusterable feature for an unclusterable geometry and back.
@mourner
Copy link
Member

mourner commented Jul 5, 2018

Addressed in mourner/kdbush.hpp@1e22d35

@mourner
Copy link
Member

mourner commented Jul 10, 2018

#19

@mourner mourner closed this as completed Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants