-
Notifications
You must be signed in to change notification settings - Fork 55
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
OS Error 22: invalid argument when opening transactions on threads #135
Comments
This issue seems directly related to lmdb and not heed. |
After creating the tmp_env directories, worked fine here on Linux. Will try Mac shortly. |
Works fine here
|
Ah, sorry, I used 10 threads in the linked example, but you need at least 11 to see the issue (at least on Mac M1). I updated the example in the repository and in the issue description above. |
It's failing in LOCK_MUTEX, which defaults to using semop() on MacOS.
So this appears to be an OS limitation. No idea if/how that's tunable, I leave that up to you. |
Instead of using the default SysV Semaphores, you can compile mdb.c with -DMDB_USE_POSIX_SEM and this problem goes away. Unfortunately POSIX semaphores on MacOS aren't robust, killing a process that holds a semaphore will leave it locked. |
And thus, if I understood correctly, limiting our number of threads to 10 would work? |
I suppose so. Or just stop creating so many environments. Why are you using one environment per thread? |
Meilisearch is not specifically creating one environment by thread, but when we run the tests, it produces this behavior as the tests are run in parallel. So the easy fix for that is to reduce the number of tests run at the same time in the CI. The real issue is that on arch Linux, we had another issue returning an os error 22: we can't create any Meilisearch index on this OS. We will see if the above minimal reproducible example is the one that triggers this bug or not. We thought it was the same bug. |
Or run tests in separate processes instead of separate threads. |
Thank you for your insight, hyc, you pinpointing which resource is limited was really helpful. Some points about this issue:
|
Bug description
When running the following example using heed, we get unwraps of error 22: invalid argument:
(see the associated repository for more information)
Raw lmdb reproducer
The issue can be further minimized in C, directly using the master branch (not master3) of lmdb instead of heed, with the following:
(see the associated repository for more information)
Likely related to meilisearch/meilisearch#3017
The text was updated successfully, but these errors were encountered: