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: Index restore view=True does not work for shared user index #442

Open
3 tasks done
sef43 opened this issue Jun 10, 2024 · 2 comments
Open
3 tasks done

Bug: Index restore view=True does not work for shared user index #442

sef43 opened this issue Jun 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sef43
Copy link

sef43 commented Jun 10, 2024

Describe the bug

If I try and do Index.restore(, view=True) on an index file created by a different user I get an error:

Traceback (most recent call last):
  File "/home/sfarr_test/test_load.py", line 5, in <module>
    index=Index.restore('test.index', view=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sfarr_test/usearch/lib/python3.11/site-packages/usearch/index.py", line 604, in restore
    index.view(path_or_buffer)
  File "/home/sfarr_test/usearch/lib/python3.11/site-packages/usearch/index.py", line 975, in view
    self._compiled.view_index_from_path(os.fspath(path_or_buffer), progress)
RuntimeError: Operation not permitted

Steps to reproduce

with user 1:

import numpy as np
from usearch.index import Index

index = Index(ndim=4)


vectors = np.random.random(size=(100,4))

index.add(list(range(len(vectors))), vectors)

print(index)
index.save('test.index')

with user 2:

import numpy as np
from usearch.index import Index


index=Index.restore('test.index', view=True)
print(index)

Expected behavior

The index should restore for user2 if view=True. It only restores properly if I change to view=False

USearch version

2.11.7

Operating System

Ubuntu 22.04

Hardware architecture

x86

Which interface are you using?

Python bindings

Contact Details

No response

Are you open to being tagged as a contributor?

  • I am open to being mentioned in the project .git history as a contributor

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@sef43 sef43 added the bug Something isn't working label Jun 10, 2024
@ashvardanian
Copy link
Contributor

That sounds like a file permissions issue unrelated to USearch. Can you try creating and reading an arbitrary text file? Or simply checking file permissions?

@sef43
Copy link
Author

sef43 commented Jun 10, 2024

Yes that is my main thought, I have checked this as much as possible. If I use Index.restore('test.index') it loads sucessfully. It is only when I try and use view=True where there is the error. There are no permission errors for other file operations. I am wondering if it is something related to the memory mapping settings.

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

2 participants