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

Bug: instacrash of fluid.knnclassifier~ when loading empty dictionary #422

Open
rconstanzo opened this issue May 19, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@rconstanzo
Copy link

rconstanzo commented May 19, 2024

Please tell us what you were doing! You can include code and files by drag and dropping them into the text area.

I found an instacrash when you try and load a dict into fluid.knnclassifier~ that was created by a fluid.classifier~ prior to having fed it any data.

When you dump or write a fluid.knnclassifier~ without data empty you get the following dictionary contents:

{
	"labels" : 	{
		"cols" : 1
	}
,
	"tree" : 	{
		"cols" : 0,
		"data" : null,
		"ids" : [  ],
		"rows" : 0,
		"tree" : null
	}

}

Here's a patch to reproduce:
Screenshot 2024-05-20 at 12 01 56 AM

<pre><code>
----------begin_max5_patcher----------
723.3ocwV0zbZCCD8r8uBUclxfr4iPO0i8R+EzoCivdgnTaIOxxDRxj9auRq
rHl.NAHz1CVy30qzaeO8zZ8TbDcoZKTSIeg7CRTzSwQQXHWfn12ink7sYE7Z
LMZlprDjF5.+2LvVCFOYHISyquk7c91OE9ZgPBYpFIlRRavUJooV7H3hwlNb
TmvRdIFl9MnXCXDY7vJIaJExBvfEAqMXE2jcqPtdgFxLdRjlZWPxTlab1Mtw
T6H4murLpFSXc5B8JdFzcsE4XgnVd2mmQcgdNN1ML3CpSrgjMB3dRtHyPxr.
aSp9+mdwtAErjYtQFK85nXoWhhsrwXTxyk.SvRlMZLRici8T+gExGx7PE3WE
5RtbMc2j5PkozcXqspsAzK.IeYANwQW.Mkv8108.ewiEDMr9nrO4M19Rlize
xrvFmk9I8R+j9nOcf84XzmcI6jNu8PmK+b2LS7GbYiQ5jjN0StouqerSEO4e
m2iM12g4uk2a7+HuG1KR1TTP9JTtDxIry1G5Uh4I91Hr2wGNoOovUIBkjqe.
cjceNl.kjFJzbtg2R7Vla6lxWBE0gngvQ1Vy9nLe.q70NAiFf9Su0q0ALmjs
KnHu8+ngB0FSqt+USM.gapA3i6VEzZ9FHegkcVwcA2XzBq4DpeM4vMpN1JKc
g07rG5B2w8MG9wRdU0d1p1h553tVUzHxG9KoDyTrR.5ee1mz784RF6a2MZ10
uQ2b50ixUZnBj4jBEO+Ro5H7rzr4uCS6sqROrbuF5XJ3sNd0c.w5xEeetWqZ
zYA.Z+6H4kJKGpMBI2cBtSNLeNGUcOUbFeB33ZF7gAJrHuIRS1KGkNGz82Q9
phrSKYGhL6CgryTbBPO+JHumFPG5X7FUaapMfttMcDD6ww6TnFLe.9pP5eEa
yQ0vFQHeeDt1dfyXOs0n8Wcd6T+uYokJqZJaDsBJ1PlhG0cWyttp85tXGg3m
i+ymqi.X
-----------end_max5_patcher-----------
</code></pre>

What was the expected result?

It should either ignore the loaded dict or throw an error message.

What was the actual result?

Instacrash!

What operating system were you using?

Mac

Operating system version

macOS 14.4.1

FluCoMa Version

1.0.7

@rconstanzo rconstanzo added the bug Something isn't working label May 19, 2024
@rconstanzo
Copy link
Author

Here's a crash report.

Spicy bit:

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0   libc++.1.dylib                	       0x18fd2f0dc std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 20
1   fluid.libmanipulation         	       0x10ff05f30 fluid::algorithm::KDTree::unflatten(fluid::algorithm::KDTree::FlatData const&, long) const + 80
2   fluid.libmanipulation         	       0x10fef31fc fluid::algorithm::from_json(nlohmann::json_abi_v3_11_2::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>> const&, fluid::algorithm::KDTree&) + 212
3   fluid.libmanipulation         	       0x10fefed24 fluid::client::knnclassifier::from_json(nlohmann::json_abi_v3_11_2::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>> const&, fluid::client::knnclassifier::KNNClassifierData&) + 60
4   fluid.libmanipulation         	       0x10fff05d4 decltype(decltype(__declval<nlohmann::json_abi_v3_11_2::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>> const&>(0)) std::__1::declval<nlohmann::json_abi_v3_11_2::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>> const&>()().get_impl<fluid::client::knnclassifier::KNNClassifierData>(nlohmann::json_abi_v3_11_2::detail::priority_tag<4u>{})) nlohmann::json_abi_v3_11_2::basic_json<std::__1::map, std::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool, long long, unsigned long long, double, std::__1::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>>::get<fluid::client::knnclassifier::KNNClassifierData, fluid::client::knnclassifier::KNNClassifierData>() const + 128
5   fluid.libmanipulation         	       0x10ffee8ac fluid::client::DataClient<fluid::client::knnclassifier::KNNClassifierData>::load(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>) + 256
6   fluid.libmanipulation         	       0x1100018c8 _ZNK5fluid6client10MessageSetINSt3__15tupleIJNS0_7MessageIZNS0_11makeMessageINS0_13MessageResultIvEENS0_13knnclassifier19KNNClassifierClientEJNS0_15SharedClientRefIKNS0_7dataset13DataSetClientEEENSA_IKNS0_8labelset14LabelSetClientEEEEEEDaPKcMT0_FT_DpT1_EEUlRS9_SE_SI_E_S7_S9_JSE_SI_EEENS4_IZNS0_11makeMessageIS7_S9_JSE_NSA_ISG_EEEEESJ_SL_MSM_KFSN_SP_EEUlSS_SE_SW_E_S7_S9_JSE_SW_EEENS4_IZNSV_INS6_INS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEES9_JNS2_10shared_ptrIKNS0_13BufferAdaptorEEEEEESJ_SL_SY_EUlSS_S1B_E_S17_S9_JS1B_EEENS4_IZNSV_INS6_IlEENS0_10DataClientINS8_17KNNClassifierDataEEEJEEESJ_SL_SY_EUlRS1H_E_S1E_S1H_JEEENS4_IZNS5_IS7_S1H_JEEESJ_SL_SR_EUlS1I_E_S7_S1H_JEEES1K_NS4_IZNS5_IS7_S1H_JS16_EEESJ_SL_SR_EUlS1I_S16_E_S7_S1H_JS16_EEENS4_IZNS5_IS17_S1H_JEEESJ_SL_SR_EUlS1I_E_S17_S1H_JEEES1O_S1O_EEEE6invokeILm6EJRNS0_24NRTSharedInstanceAdaptorIS9_E12SharedClientERSL_EEEDcDpOT0_ + 240
7   fluid.libmanipulation         	       0x1100017bc decltype(auto) fluid::client::NRTThreadingAdaptor<fluid::client::NRTSharedInstanceAdaptor<fluid::client::knnclassifier::KNNClassifierClient>>::invoke<6ul, fluid::client::NRTThreadingAdaptor<fluid::client::NRTSharedInstanceAdaptor<fluid::client::knnclassifier::KNNClassifierClient>>, char const*&>(fluid::client::NRTThreadingAdaptor<fluid::client::NRTSharedInstanceAdaptor<fluid::client::knnclassifier::KNNClassifierClient>>&, char const*&) + 420
8   fluid.libmanipulation         	       0x1100013dc void fluid::client::FluidMaxWrapper<fluid::client::NRTThreadingAdaptor<fluid::client::NRTSharedInstanceAdaptor<fluid::client::knnclassifier::KNNClassifierClient>>>::doLoad<6ul>(fluid::client::FluidMaxWrapper<fluid::client::NRTThreadingAdaptor<fluid::client::NRTSharedInstanceAdaptor<fluid::client::knnclassifier::KNNClassifierClient>>>*, symbol*, long, atom*) + 340

null crash 2.zip

@rconstanzo
Copy link
Author

Can confirm that this crashes pd (0.53) as well.

Screenshot 2024-05-20 at 5 03 48 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant