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]: Flask debug mode and Milvus Local appear to conflict #2193

Open
1 task done
speechwrecko opened this issue Jul 22, 2024 · 8 comments
Open
1 task done

[Bug]: Flask debug mode and Milvus Local appear to conflict #2193

speechwrecko opened this issue Jul 22, 2024 · 8 comments
Labels
kind/bug Something isn't working

Comments

@speechwrecko
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I run PyMilvus with Milvus Local in a Python Flask application with debug set to True, Milvus fails saying it "Can't start local milvus" because the file is being used by another program.

It's as if FLASK debug is locking the file or perhaps there is some other odd issue

Stack trace:

Open demo.db failed, the file has been opened by another program
Start local milvus failed
Failed to create new connection using: c767688b751d4e47b68295a896cca39a
Traceback (most recent call last):
....
File "/home/jason/.local/lib/python3.8/site-packages/pymilvus/milvus_client/milvus_client.py", line 58, in init
self._using = self._create_connection(
File "/home/jason/.local/lib/python3.8/site-packages/pymilvus/milvus_client/milvus_client.py", line 651, in _create_connection
raise ex from ex
File "/home/jason/.local/lib/python3.8/site-packages/pymilvus/milvus_client/milvus_client.py", line 648, in _create_connection
connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
File "/home/jason/.local/lib/python3.8/site-packages/pymilvus/orm/connections.py", line 382, in connect
raise ConnectionConfigException(message="Open local milvus failed")
pymilvus.exceptions.ConnectionConfigException: <ConnectionConfigException: (code=1, message=Open local milvus failed)>

Expected Behavior

I see no reason why this shouldn't work and it implies there might be a larger issue

Steps/Code To Reproduce behavior

Create a simple flask app and load a local milvus file.  Set debug to true.

app.run(debug=True)

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory):
- Method of installation (Docker, or from source):
- Milvus version (v0.3.1, or v0.4.0):
- Milvus configuration (Settings you made in `server_config.yaml`):

Anything else?

No response

@speechwrecko speechwrecko added the kind/bug Something isn't working label Jul 22, 2024
@thom-bahm
Copy link

+1, I ran into this issue as well.

@trish11953
Copy link

Got the same error with demo.db while using multiple Ray Serve replicas. Any solution?

@wyhanz
Copy link

wyhanz commented Oct 15, 2024

+1

@wyhanz
Copy link

wyhanz commented Oct 15, 2024

+1

This bug can even be reproduced in a simple way. After creating a database connection, I insert three records, each with 768 dimensions. Immediately after, I let the program sleep for 60 seconds. When I create a new connection after that, the aforementioned error occurs. However, if I restart the program quickly, the error does not happen, and the program runs normally. I find this situation really confusing.

@AlexKupreev
Copy link

AlexKupreev commented Oct 27, 2024

The same while working from different jupyter notebooks - the first one works as expected, but in the second one the error happens. Only manual deletion of .lock file helped.

@husongjiang
Copy link

在sanic多进程中使用也会遇到类似错误。Open milvus.db failed, the file has been opened by another program Start local milvus failed。Failed to create new connection using:XXX

@photosartd
Copy link

Same problem while working with pymilvus locally, can't get any logic behind the unexpected errors while opening the db

@mertbozkir
Copy link

I just solved it by changing the flask API debugging mode to false! 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants