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

Server crash with bad descriptor data #92

Closed
prashastk opened this issue Mar 18, 2019 · 3 comments
Closed

Server crash with bad descriptor data #92

prashastk opened this issue Mar 18, 2019 · 3 comments
Assignees
Labels
Bug Indicates unexpected or undesired behaviors

Comments

@prashastk
Copy link

Some bug in my code added descriptor blobs which had gone through the following transformations:

np_blob = a 64 dim np float32 array
blob = np.frombuffer(np_blob.tobytes()).tobytes()

After this blob becomes a 32 dim np.float array.

Issue 1 - AddDescriptor for a 64 dim set worked fine with this blob
Issue 2 - A FindDescriptor query with k_neighbors crashes the server:
Server log

vdms: src/property.cc:44: PMGD::Property::Property(const PMGD::Property&): Assertion `0' failed.
@vishakha041 vishakha041 added the Bug Indicates unexpected or undesired behaviors label Mar 18, 2019
@luisremis
Copy link
Contributor

I have added an extra test for Issue 1 and the it seems the server will correctly catch when the dimension of the blob mismatches. I was not able to reproduce Issue 1.

Can you provide more info?

This is the test I am using to try to replicate.

def test_addSetAndDescriptorsDimMismatch(self):

    db = self.create_connection()

    all_queries = []

    # Add Set
    set_name = "features_64d_dim_mismatched"
    dims = 64
    descriptor_set = {}
    descriptor_set["name"] = set_name
    descriptor_set["dimensions"] = dims

    query = {}
    query["AddDescriptorSet"] = descriptor_set

    all_queries.append(query)

    response, img_array = db.query(all_queries)
    self.assertEqual(response[0]["AddDescriptorSet"]["status"], 0)

    # Add Descriptors
    all_queries = []
    descriptor_blob = []

    x = np.zeros(dims/2)
    x = x.astype('float32')
    # print type(x[0])
    # print "size: ", len(x.tobytes())/4
    descriptor_blob.append(x.tobytes())

    descriptor = {}
    descriptor["set"] = set_name

    query = {}
    query["AddDescriptor"] = descriptor

    all_queries.append(query)

    response, img_array = db.query(all_queries, [descriptor_blob])
    print(db.get_last_response_str())

    # Check correct error
    self.assertEqual(response[0]["status"], -1)
    self.assertEqual(response[0]["info"], "Blob Dimensions Mismatch")

Also, can you provide more detail on Issue 2?
Does this happen after the AddDescriptor in Issue 1 is done?

Thanks!

@prashastk
Copy link
Author

This should produce Issue 1:

    x = np.zeros(dims/2)
    x = x.astype('float32').tobytes()
    x = np.frombuffer(x.tobytes()).tobytes()
    descriptor_blob.append(x)

(I'll try to re-produce it tomorrow and update this)

Issue 2 was happening after data with the Issue 1 was added into the server.

@luisremis
Copy link
Contributor

I tried that way as well, and get an error:

x = np.frombuffer(x.tobytes()).tobytes()
    AttributeError: 'str' object has no attribute 'tobytes'

I was not able to reproduce this error, even with a couple of different wrong sizes.

I will add more testcases for this issues in #101 for the future, and close this issues unless/until we find a way to reproduce it.

Thanks!

cwlacewe added a commit to cwlacewe/vdms that referenced this issue Apr 14, 2023
* Unify ports for unit tests
* Fic gcov error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indicates unexpected or undesired behaviors
Projects
None yet
Development

No branches or pull requests

3 participants