You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mysql-mcp-server: startup self-test crashes the first real query with "bound to a different event loop" #4620
With --connection_method MYSQL_WIRE_PROTOCOL or MYSQL_WIRE_IAM_PROTOCOL, the server logs a successful startup validation and then crashes on the very first real query from an MCP client.
Expected Behavior
After "Successfully validated database connection to MySQL", the server serves queries normally.
Current Behavior
The startup self-test passes and logs success, then the first run_query/get_table_schema call from a client raises:
RuntimeError: <aiorwlock._RWLockCore object at 0x...> is bound to a different event loop
Full traceback from my repro below:
Traceback (most recent call last):
File "asyncmy_pool_connection.py", line 227, in check_expiry
async with self.rw_lock.reader_lock:
File "aiorwlock/__init__.py", line 218, in __aenter__
await self.acquire()
File "aiorwlock/__init__.py", line 245, in acquire
await self._lock.acquire_read()
File "aiorwlock/__init__.py", line 64, in _get_loop
raise RuntimeError(f"{self!r} is bound to a different event loop")
Reproduction Steps
This reproduces with the real AsyncmyPoolConnection class, asyncmy stubbed out since the crash never reaches a real query:
Second asyncio.run() call raises the RuntimeError above. Tested against current main (83ac913, awslabs.mysql-mcp-server 1.1.2), Python 3.12.
Possible Solution
postgres-mcp-server had the identical symptom (startup self-test succeeds, then the first query crashes the same way) and it looks like #4514 just fixed that one. Might be worth checking whether mysql-mcp-server needs the same treatment.
Additional Information/Context
Found while looking at #4380, which describes the postgres-mcp-server side of this.
OS
Not OS-specific, this is server-side asyncio/event-loop behavior.
Server
mysql-mcp-server
Server Version
1.1.2
Region
Not region-specific, the crash happens before any query reaches the database.
Service quota
Not applicable, this bug is unrelated to service quotas.
Activity
fix(mysql-mcp-server): run startup validation on the serving event loop