Closed mrjoli021 closed 3 years ago
try --protocol tcp
in your mysql command in your healthcheck. I think its falsely reporting active during the initialization stages where the server does start up (on unix socket only, no tcp, hence using it in the healthcheck).
Also check the logs of the python container, especially after changing the healthcheck. If the mariadb container is definitely running, then a stack track of the python connector used may help resolve it having some protocol error with MariaDB.
Its not a connection refused so that a good sign the containers are connected.
Changed it to TCP and now it is connecting, but I am still getting these errors. Not as frequent as before, before is was just filling up the log constantly. Now I am getting them one every few min.
Can you show part of the python backtrace when this occurs? Which python connector and version are you using?
I am new to Alchemy. So I am literally just copying and pasting the code from their intro site, just with user/pass https://mariadb.com/resources/blog/using-sqlalchemy-with-mariadb-connector-python-part-1/
I am not getting any errors on the Python container and it prints the info correctly. The only errors that show up is on the DB container and again they are showing up once every 10-15 min apart. If I remove the TCP option, I start getting the errors constantly and my python is still running now.
for comparison pip3 install PyMySQL
and use mariadb+pymysql://
as the beginning of the url.
After I changed it to pymsql I have not gotten any more errors and my app is working correctly now. Thanks
I suspect the error message was an idle pool connection reaching its idle_timeout. Provided it was truly an idle connection not being used by you application there probably wasn't an error as such. I'm not sure why it didn't cleanly shutdown the connection.
It could also be timing out at the network tcp layer if you are traversing a stateful firewall.
If you do go back to using MariaDB Connector/Python you can create bug reports on JIRA on the CONPY project.
Welcome to MariaDB and Python programming.
I am running MariaDB 10.5 with the following compose file. If I connect to the cli of the DB container I am able to connect to the db with the user. But the Python container is not able to. I keep getting the following error messages on the console of the MariadB container.
[Warning] Aborted connection 11 to db: 'db' user: 'db_user' host: '172.29.0.3' (Got an error reading communication packets).