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

Cannot allocate memory #3488

Closed
newdev8 opened this issue Feb 13, 2023 · 17 comments
Closed

Cannot allocate memory #3488

newdev8 opened this issue Feb 13, 2023 · 17 comments
Labels
bug Something isn't working as expected v1.1.0 PRs/issues solved in v1.1.0 released on 2023-04-03
Milestone

Comments

@newdev8
Copy link

newdev8 commented Feb 13, 2023

Describe the bug
When creating an index in a freshly created Meilisearch instance I get the error Cannot allocate memory (os error 12)

To Reproduce
Steps to reproduce the behavior:

  1. Download the new release of Meilisearch v1.0.0
  2. Execute it
  3. Try to add a new index
  4. Get the error

Expected behavior
As it happens in the previous version of Meilisearch (v0.30.5), it should create an index.

Screenshots
Not applicable

Meilisearch version:
v1.0.0

Additional context
Meilisearch works perfectly fine in the previous version (v0.30.5), but not in the newest one (v1.0.0).
It's a freshly created instance, with no current indexes/documents.

Running on the latest version of DietPi (v8.14.2) on a Raspberry Pi 4b with 8GB of RAM.

@curquiza
Copy link
Member

Hello @newdev8
Thanks for the report!
@dureuill, is it related to the work of --max-db-size removal?

@curquiza curquiza added the bug Something isn't working as expected label Feb 13, 2023
@dureuill
Copy link
Contributor

@dureuill, is it related to the work of --max-db-size removal?

Yes, this is very likely. Probably the OS was fine with a default index size of 100GiB, but rejects the default index size of 500GiB.

Hi @newdev8, would you be interested in testing our prototype-unlimited-indexes-0 to see if v1.1 is going to fix your issue?

@newdev8
Copy link
Author

newdev8 commented Feb 13, 2023

@dureuill Sure! Give me a minute.

@dureuill
Copy link
Contributor

dureuill commented Feb 13, 2023

OK great!

To get the prototype, you can either use docker or build it from source.

  • Using docker, run the following command from your RPI: docker run -p 7700:7700 -v $(pwd)/meili_data:/meili_data getmeili/meilisearch:prototype-multi-search-0 docker run -p 7700:7700 -v $(pwd)/meili_data:/meili_data getmeili/meilisearch:prototype-unlimited-indexes-0
  • From source, clone the Meilisearch repository and compile it on the prototype-unlimited-indexes-0 (You either need to compile on the RPI or to cross-compile)

🙏 Please do not use this in production though, it is a prototype ⚠️

If everything goes well with testing, then we'll release these changes in v1.1

@dureuill
Copy link
Contributor

Ah sorry @newdev8 I gave the wrong prototype name in my previous message. I just fixed it above.

@curquiza curquiza added this to the v1.1.0 milestone Feb 13, 2023
@newdev8
Copy link
Author

newdev8 commented Feb 13, 2023

Compiled from source and it works perfectly!
I'll be waiting for the next release of Meilisearch to update.

Thanks @curquiza and @dureuill for your quick responses!

@newdev8 newdev8 closed this as completed Feb 13, 2023
@dureuill
Copy link
Contributor

Thank you so much for trying the prototype and reporting on it, @newdev8 !

Just to make sure, was the issue happening on adding the first index to your Meilisearch instance, or after adding some number of indexes? In v0.30, were you using the (now removed) --max-index-size option or did it work without the option?

@newdev8
Copy link
Author

newdev8 commented Feb 13, 2023

The issue was happening after adding the first index, it was a fresh instance.
In previous versions I didn't need to add the --max-index-size.

@dureuill
Copy link
Contributor

Thank you so much for coming back to us. The information you provided will help us refine the prototype for v1.1!

@xywf221
Copy link

xywf221 commented Feb 16, 2023

this problem also occurs on one of my android

@dureuill
Copy link
Contributor

dureuill commented Feb 16, 2023

Hello @xywf221 👋

for my information, how are you obtaining meilisearch binaries for android? Are you compiling them from source? We're not testing android ourselves at the moment, so it would help us if you could maybe try the prototype I linked above and tell us if it resolves the issue for you.

In case it doesn't, I'm putting a second prototype out by tomorrow I think.

Thank you for the time taken to help us improve meilisearch ❤️

@xywf221
Copy link

xywf221 commented Feb 16, 2023

hi @dureuill
Thank you for your quick reply. my operating environment is a debian installed by Xiaomi 6 using Linux Deploy. It is essentially the same as linux aarch64

I'm using curl - L https://install.meilisearch.com |Sh get binary

docker cannot be used for some reason, I don't know anything about rust. cross-compile may be a little difficult for me.
Is there any simple cross-compile script

@dureuill
Copy link
Contributor

Hello again @xywf221

I don't have experience with cross-compiling Rust to aarch64, sorry!

@dureuill
Copy link
Contributor

Hello @newdev8,

I just released a second prototype (on tag prototype-unlimited-indexes-1) that uses a different approach. If it is possible for you, could you test it again? In particular, it would be interesting for me to find out:

  • if the new version has a significantly different startup time
  • what the first three lines of logs appearing above the Meilisearch logo read.

Thank you for helping make Meilisearch better ❤️

@newdev8
Copy link
Author

newdev8 commented Feb 21, 2023

Hello @dureuill

I've tested your prototype, I can't say if the startup time is faster as both versions start really fast (I would say at the same time). Your prototype does work in my machine.

The three lines are:
[2023-02-21T13:38:19Z INFO index_scheduler] memmap budget: 366668349439B
[2023-02-21T13:38:19Z INFO index_scheduler] index budget: 172596756479B
[2023-02-21T13:38:19Z WARN index_scheduler] 1 index of 69038702591B can be opened simultaneously.

@dureuill
Copy link
Contributor

Wow, thank you for the tests!

I'm glad to learn that startup is still fast, and that it works with this new approach. As you can see from the logs, you have about 350GiB of virtual address space, which is why the v1.0, that opens indexes with a mmap of 500GiB in size, did not work.

This new prototype accounts for this by computing the exact "budget" of virtual address space you have, and allocating a part of that to opening indexes. The previous prototype woul open the indexes with very small mmap and resize on the fly, but this came with a heavy performance hit when an index needed resize.

Thank you again for the tests, I'm very happy to learn it works for you ❤️

@newdev8
Copy link
Author

newdev8 commented Feb 21, 2023

I'm happy to test the Meilisearch dev versions and I'll be awaiting the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected v1.1.0 PRs/issues solved in v1.1.0 released on 2023-04-03
Projects
None yet
Development

No branches or pull requests

5 participants