Closed spicymatt closed 1 year ago
Hey, @spicymatt! Thank you for reaching out! I wasn't aware of anyone already using the Swift embeddings! Cool!
As for your question, fread
is a pure C function. They have no exceptions. The ABI does not support it. I would expect the following to happen in your case:
fread
is wrapped into a serialization_result_t
and exported out.load_from_stream
propagates it up, say from here.That being said, I can try replicating your setup. Will come back soon. Feel free to provide any more details 🤗
Hi, Thanks for getting back. I don't think that the is what happens...unless I am mistaken. See the attached stack trace. std:terminate is called.
We are using USearch to replace FAISS on mobile (iOS). Thanks for your amazing work....we see a number of areas where we would want to see improvements (and maybe we can help)...especially in the addition of vectors (Faiss has a MT addition method to the cluster which is very speedy).
I have replicated the error, @spicymatt. Thank you for sharing the details! Still thinking of the ways to solve it :)
@spicymatt, I think I've found that nasty bug. You should be able to try it in minutes. Please let me know if it worked :)
Describe the bug
We are using USearch from swift When a saved index cannot be loaded because, say, the file has been corrupted during save(), the lib crashes. We get a runtime exception that cannot be caught.
My question is as follows (sorry for being newbie in c++):
There is a mechanism in Swift to ensure that C exception can be handled via ObjC bridging...requires some easy code...but since these methods will call std:terminate when there is an error in loading the index, it won't help
Steps to reproduce
create an index and corrupt the file on disk try to load it it crashes the runtime
Expected behavior
the runtime should not crash exception should be sent to the caller of the library
USearch version
1.3.0
Operating System
macOS
Hardware architecture
Arm
Which interface are you using?
C++ implementation
Contact Details
mk@cyme.io
Is there an existing issue for this?
Code of Conduct