{"action":"created","issue":{"url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/851","labels_url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/851/labels{/name}","comments_url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/851/comments","events_url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/851/events","html_url":"https://github.com/Unvanquished/Unvanquished/issues/851","id":120842047,"number":851,"title":"Clustering code can crash when there are no recorded entities","user":{"login":"Kangz","id":472810,"avatar_url":"https://avatars.githubusercontent.com/u/472810?v=3","gravatar_id":"","url":"https://api.github.com/users/Kangz","html_url":"https://github.com/Kangz","followers_url":"https://api.github.com/users/Kangz/followers","following_url":"https://api.github.com/users/Kangz/following{/other_user}","gists_url":"https://api.github.com/users/Kangz/gists{/gist_id}","starred_url":"https://api.github.com/users/Kangz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kangz/subscriptions","organizations_url":"https://api.github.com/users/Kangz/orgs","repos_url":"https://api.github.com/users/Kangz/repos","events_url":"https://api.github.com/users/Kangz/events{/privacy}","received_events_url":"https://api.github.com/users/Kangz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Unvanquished/Unvanquished/labels/A-Gamelogic","name":"A-Gamelogic","color":"f7c6c7"},{"url":"https://api.github.com/repos/Unvanquished/Unvanquished/labels/T-Bug","name":"T-Bug","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"Viech","id":3780206,"avatar_url":"https://avatars.githubusercontent.com/u/3780206?v=3","gravatar_id":"","url":"https://api.github.com/users/Viech","html_url":"https://github.com/Viech","followers_url":"https://api.github.com/users/Viech/followers","following_url":"https://api.github.com/users/Viech/following{/other_user}","gists_url":"https://api.github.com/users/Viech/gists{/gist_id}","starred_url":"https://api.github.com/users/Viech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viech/subscriptions","organizations_url":"https://api.github.com/users/Viech/orgs","repos_url":"https://api.github.com/users/Viech/repos","events_url":"https://api.github.com/users/Viech/events{/privacy}","received_events_url":"https://api.github.com/users/Viech/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-12-07T18:54:08Z","updated_at":"2015-12-23T00:08:14Z","closed_at":null,"body":"Caldazar produced the following backtrace:\r\n\r\n```\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n[Switching to Thread 0x7fffc182e700 (LWP 12514)]\r\n0x00007fffc1a2b8e2 in CM_Trace (results=0x7fffc182c58c, start=0x5c, end=0x7fffbc0b4578, mins=0x7fffc182c540, maxs=0x7fffc182c530, model=0, origin=0x7fffc22ba8a8 <vec3_origin>, brushmask=1, \r\n    skipmask=0, type=TT_AABB, sphere=0x0) at /home/martin/src/unvanquished/daemon/src/common/cm/cm_trace.cpp:2116\r\n\t2116\t\t\ttw.start[ i ] = start[ i ] + offset[ i ];\r\n\t(gdb) bt\r\n#0  0x00007fffc1a2b8e2 in CM_Trace (results=0x7fffc182c58c, start=0x5c, end=0x7fffbc0b4578, mins=0x7fffc182c540, maxs=0x7fffc182c530, model=0, origin=0x7fffc22ba8a8 <vec3_origin>, \r\n\t    brushmask=1, skipmask=0, type=TT_AABB, sphere=0x0) at /home/martin/src/unvanquished/daemon/src/common/cm/cm_trace.cpp:2116\r\n#1  0x00007fffc1a2c1b4 in CM_BoxTrace (results=0x7fffc182c58c, start=0x5c, end=0x7fffbc0b4578, mins=0x7fffc182c540, maxs=0x7fffc182c530, model=0, brushmask=1, skipmask=0, type=TT_AABB)\r\n\t\t    at /home/martin/src/unvanquished/daemon/src/common/cm/cm_trace.cpp:2336\r\n#2  0x00007fffc19383ac in G_CM_Trace (results=0x7fffc182c680, start=0x5c, mins2=0x7fffc182c640, maxs2=0x7fffc22ba8a8 <vec3_origin>, end=0x7fffbc0b4578, passEntityNum=0, contentmask=1, \r\n\t\t\t    skipmask=0, type=TT_AABB) at /home/martin/src/unvanquished/src/sgame/sg_cm_world.cpp:910\r\n#3  0x00007fffc18e072e in trap_Trace (results=0x7fffc182c680, start=0x5c, mins=0x7fffc182c640, maxs=0x0, end=0x7fffbc0b4578, passEntityNum=0, contentmask=1, skipmask=0)\r\n\t\t\t\t    at /home/martin/src/unvanquished/src/sgame/sg_api.cpp:187\r\n#4  0x00007fffc18b932f in BaseClustering::PostChangeHook (layer=BaseClustering::BCL_ALIEN_FRIENDLY) at /home/martin/src/unvanquished/src/sgame/Clustering.cpp:549\r\n#5  0x00007fffc18b989a in BaseClustering::Update (beacon=0x7fffc0cb71f0) at /home/martin/src/unvanquished/src/sgame/Clustering.cpp:614\r\n#6  0x00007fffc18b8fb0 in Beacon::Tag (ent=0x7fffc0cb65c0, team=TEAM_ALIENS, permanent=true) at /home/martin/src/unvanquished/src/sgame/Beacon.cpp:746\r\n#7  0x00007fffc1921026 in Build (builder=0x7fffc0c5e000, buildable=BA_A_LEECH, origin=0x7fffc182d1a0, normal=0x7fffc182d190, angles=0x7fffc0c5e03c, groundEntNum=1022)\r\n\t\t\t\t\t    at /home/martin/src/unvanquished/src/sgame/sg_buildable.cpp:4396\r\n#8  0x00007fffc192117f in G_BuildIfValid (ent=0x7fffc0c5e000, buildable=BA_A_LEECH) at /home/martin/src/unvanquished/src/sgame/sg_buildable.cpp:4417\r\n#9  0x00007fffc195e1d1 in FireBuild (self=0x7fffc0c5e000, menu=MN_A_BUILD) at /home/martin/src/unvanquished/src/sgame/sg_weapon.cpp:1201\r\n#10 0x00007fffc196028c in G_FireWeapon (self=0x7fffc0c5e000, weapon=WP_ABUILD2, weaponMode=WPM_PRIMARY) at /home/martin/src/unvanquished/src/sgame/sg_weapon.cpp:1865\r\n#11 0x00007fffc18cd80b in ClientEvents (ent=0x7fffc0c5e000, oldEventSequence=38) at /home/martin/src/unvanquished/src/sgame/sg_active.cpp:1139\r\n#12 0x00007fffc18d00e1 in ClientThink_real (self=0x7fffc0c5e000) at /home/martin/src/unvanquished/src/sgame/sg_active.cpp:2134\r\n#13 0x00007fffc18d06dc in ClientThink (clientNum=0) at /home/martin/src/unvanquished/src/sgame/sg_active.cpp:2260\r\n#14 0x00007fffc18dff15 in VM::<lambda(int)>::operator()(int) const (__closure=0x7fffc182d82f, clientNum=0) at /home/martin/src/unvanquished/src/sgame/sg_api.cpp:86\r\n#15 0x00007fffc18e33db in Util::apply_impl<VM::VMHandleSyscall(uint32_t, Util::Reader)::<lambda(int)>, std::tuple<int&&>, 0ul>(<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x9c1e5>, <unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x9c203>, Util::seq<0ul>) (\r\n\t\t\t\t\t\t    func=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x9c1e5>, \r\n\t\t\t\t\t\t\t    tuple=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x9c203>) at /home/martin/src/unvanquished/daemon/src/common/Util.h:103\r\n#16 0x00007fffc18e3023 in Util::apply<VM::VMHandleSyscall(uint32_t, Util::Reader)::<lambda(int)>, std::tuple<int&&> >(<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x96c3b>, <unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x96c50>) (\r\n\t\t\t\t\t\t\t\t    func=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x96c3b>, \r\n\t\t\t\t\t\t\t\t\t    tuple=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x96c50>) at /home/martin/src/unvanquished/daemon/src/common/Util.h:108\r\n#17 0x00007fffc18e25fe in IPC::detail::HandleMsg<VM::VMHandleSyscall(uint32_t, Util::Reader)::<lambda(int)>, IPC::Message<IPC::Id<0u, 8u>, int>, IPC::Reply<> >(IPC::Channel &, IPC::SyncMessage<IPC::Message<IPC::Id<0u, 8u>, int>, IPC::Reply<> >, Util::Reader, <unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x933d7>) (channel=..., \r\n\t\t\t\t\t\t\t\t\t\t    reader=..., func=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x933d7>) at /home/martin/src/unvanquished/daemon/src/common/IPC/Channel.h:217\r\n#18 0x00007fffc18e1b0b in IPC::HandleMsg<IPC::SyncMessage<IPC::Message<IPC::Id<0u, 8u>, int> >, VM::VMHandleSyscall(uint32_t, Util::Reader)::<lambda(int)> >(IPC::Channel &, Util::Reader, <unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x8e46b>) (channel=..., reader=..., \r\n\t\t\t\t\t\t\t\t\t\t\t    func=<unknown type in /home/martin/src/unvanquished/build/sgame-native-dll.so, CU 0x5c06a, DIE 0x8e46b>) at /home/martin/src/unvanquished/daemon/src/common/IPC/Channel.h:241\r\n#19 0x00007fffc18e01e9 in VM::VMHandleSyscall (id=8, reader=...) at /home/martin/src/unvanquished/src/sgame/sg_api.cpp:87\r\n#20 0x00007fffc19ed320 in CommonInit (rootSocket=79) at /home/martin/src/unvanquished/daemon/src/shared/VMMain.cpp:66\r\n#21 0x00007fffc19ed470 in vmMain (rootSocket=79) at /home/martin/src/unvanquished/daemon/src/shared/VMMain.cpp:104\r\n#22 0x000000000078ee40 in VM::<lambda()>::operator()(void) const (__closure=0x26eadfa8) at /home/martin/src/unvanquished/daemon/src/engine/framework/VirtualMachine.cpp:352\r\n#23 0x0000000000790ea2 in std::_Bind_simple<VM::CreateInProcessNativeVM(std::pair<IPC::Socket, IPC::Socket>, Str::StringRef, VM::VMBase::InProcessInfo&)::<lambda()>()>::_M_invoke<>(std::_Index_tuple<>) (this=0x26eadfa8) at /usr/include/c++/5/functional:1531\r\n#24 0x0000000000790e0b in std::_Bind_simple<VM::CreateInProcessNativeVM(std::pair<IPC::Socket, IPC::Socket>, Str::StringRef, VM::VMBase::InProcessInfo&)::<lambda()>()>::operator()(void) (\r\n\t\t\t\t\t\t\t\t\t\t\t\t    this=0x26eadfa8) at /usr/include/c++/5/functional:1520\r\n#25 0x0000000000790daa in std::thread::_Impl<std::_Bind_simple<VM::CreateInProcessNativeVM(std::pair<IPC::Socket, IPC::Socket>, Str::StringRef, VM::VMBase::InProcessInfo&)::<lambda()>()> >::_M_run(void) (this=0x26eadf90) at /usr/include/c++/5/thread:115\r\n#26 0x00007ffff459c5c0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6\r\n#27 0x00007ffff3db90a4 in start_thread (arg=0x7fffc182e700) at pthread_create.c:309\r\n#28 0x00007ffff3aee06d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111\r\n\r\n\r\n\r\n(gdb) p i\r\n$1 = 0\r\n(gdb) p start[i]\r\nCannot access memory at address 0x5c\r\n```\r\n\r\nThe problem is that in BaseClusturing::PostChangeHook we don't check if the cluster still has any entity before asking the mean object. This causes the mean object returned to be null, resulting in a crash."},"comment":{"url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/comments/166766046","html_url":"https://github.com/Unvanquished/Unvanquished/issues/851#issuecomment-166766046","issue_url":"https://api.github.com/repos/Unvanquished/Unvanquished/issues/851","id":166766046,"user":{"login":"DolceTriade","id":1097524,"avatar_url":"https://avatars.githubusercontent.com/u/1097524?v=3","gravatar_id":"","url":"https://api.github.com/users/DolceTriade","html_url":"https://github.com/DolceTriade","followers_url":"https://api.github.com/users/DolceTriade/followers","following_url":"https://api.github.com/users/DolceTriade/following{/other_user}","gists_url":"https://api.github.com/users/DolceTriade/gists{/gist_id}","starred_url":"https://api.github.com/users/DolceTriade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DolceTriade/subscriptions","organizations_url":"https://api.github.com/users/DolceTriade/orgs","repos_url":"https://api.github.com/users/DolceTriade/repos","events_url":"https://api.github.com/users/DolceTriade/events{/privacy}","received_events_url":"https://api.github.com/users/DolceTriade/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T00:08:14Z","updated_at":"2015-12-23T00:08:14Z","body":"Alternatively, you can try build something while jumping."}}