MAMP MySQL innodb and missing errors - mysql

I was running MAMP fine until I brought in one particular Drupal site. The site started white-screening, loading with no CSS, and occasionally throwing a PDO error, but only on the front site of the application. I could access the administration part of the site fine.
In the mysql error log I found a bunch of errors like InnoDB: Error: Table "mysql"."innodb_table_stats" not found. and ...required persistent statistics storage is not present or is corrupted. Using transient stats instead.
I dug through some of the Drupal views and found one that executes php from the database (big no-no!). I removed that from the database but I was still getting the same innodb errors.
Next I found this question. Similar sounding issue though different circumstances. I've seen a bunch of issues that seems related, though often involving upgrading to MySQL 5.6. The gist of the issue seems to be a list of tables in the mysql tables are improperly formatted. The solution suggested there and elsewhere is to delete the .frm, .ibd files associated with those tables, then recreate the tables using the query provided.
I did all that ^, and now all the sites in MAMP are sending 500 errors. Bigger than that, the error logs are totally silent, and I'm stuck with no idea where to turn.
NOTE: I uninstalled MAMP, reinstalled it, and the same thing occured.

So, I will happily accept an answer that has a better explanation than what I'm giving here, but I "solved" this issue in the following manner:
The site was also running a module called "Sassy" that compiled CSS on the server, I was suspicious because of the missing CSS, so I configured the module to only compile when I explicitly tell it to.
I dropped and reimported each site's database.
I noticed as stated above I would get different responses on each page load. I persisted on going through the site, both admin and front side, by repeatedly reloading the pages.
In conclusion, I'm no longer getting the innodb errors, pushing through and disabling a sketchy(IMO) module seems to have fixed the white screen and 500 errors and brought back the styling. Which brings me to the big question I have which is, why wasn't I getting any error messages in the logs?

Related

Django with mysql, faced 'table doesn't exist' error randomly at different times of the day

I'm currently using Django version 2.2.28 with mysql innodb engine version 5.7, before some days i faced a crazy issue, here:
(MySQLdb._exceptions.ProgrammingError) (1146, "Table 'db_name.table_name' doesn't exist")
What's driving me crazy is that they happen on different tables at different times (not always). I couldn't even get a specific pattern.
i can confirm no change in the code happened 1 week ago and no release happened, The problem started happening 3 days ago and randomly, same table is currently working fine and a minute later the same exception is returned and then back to working fine.
i used RDS from AWS, and have different DBs under of it, the issue happening only on one of these DBs.
i also checked logs file from mysql and i don't fond any thing useful,
i just found errors like this
[ERROR] InnoDB: MySQL is freeing a thd though trx->n_mysql_tables_in_use is 2 and trx->mysql_n_tables_locked is 654
and i think it's irrelevant.
I make sure about all permissions for the user too. and i did a failover for the whole RDS and nothing working.
I don't think it has to do with django's migration command, because this problem always happened randomly.
can any one give me any idea any advice or anything ?
I hope some can help me and save a lot of time from my side.
thanks a lot guys.

django - Records not saved in MySQL database but AutoIncrement gets increased

I'm facing a weird one here.
I'm using django inside a docker container. When the system tries to save some records (mostly it works!) they don't end up in the database.
When I view the process in the debugger, the django objects gets saved, it gets an ID from the database and inside the django world everything seems fine.
But the record never shows up in the database! Even weirder: If I look at the table's meta options I see that per record which should have been created the AutoIncrement is increased. So it appears the database knows about the records but dedides not so save them...
I tried it on my Windows machine, the server runs UNIX, both have the same issue.
I'm using django==2.0.9 and mysqlclient==1.3.13 connecting to a MariaDB.
When I switch the table engine from InnoDB to MyISAM then it works.
Reproducibly it happens for the django-axes tables but I experienced the issue in other parts of the system as well. The calls come via the django-restframework to django.
Frankly I have no idea where to start looking for the issue.
On Windows and (server's) UNIX it occurs, on another's developers UNIX, it works
I downgraded latest mysqlclient, no effect
Google doesn't say anything or I'm not asking the right questions
MySQL error log keeps silent.
I also tried the latest MariaDB image 10.3.
Ok, without ever finding out what I can do about it, I switched the database engine for these explicit tables to MyISAM, now it works. Super weird.

Frequent Mysql gone away (Error 2006) in production environment

I am running a website on django 1.10, python3.4, mysqlclient, mysql5.5.
I have multiple management command running in the background for various tasks (like mail sending, updating tables) at different times. Recently, I have started seeing many Mysql gone away (Error 2006).
I tried to change the connection_timeout to be greater than max_connection age. That solved a small share of problem in which Error 2006 stopped to occur for a running function in most of the case but other cases are as it is and frequently seeing Error 2006.
In some cases, I tried using django.db.connection.close() before running a function or putting it in try - except loop. In those places, this error are not occuring anymore but then I cannot put this try-except loop in every function.
What is the root cause of this repeated error Mysql gone away? What are the different solution and what is the best solution so that I do not have to change much of my codes?
Other Variables:
We upgraded from django 1.7 to 1.10 and updated the mysqlclient package recently and the problem surfaced after that probably.
Just around the update, the traffic on our site also increased multiple times. Can that be a trigger?
As seen elsewhere, the problem can be either that your query is too long, or the server closed the connection due to inactivity. It depends a lot on the circumstances, but it seems that if you're not in the middle of a transaction (which would discard the second possibility), you can apply something similar to Hook available for automatic retry after deadlock in django and mysql setup

Drupal site: mysql queries not closing and entry resource limit reached

I have a drupal site (castlehillbasin.co.nz) that has a small number of users. Over the last few days it has suddenly hit the "entry processes limit" continually.
My host provider has shown me that there are many open queries that are sleeping, so are not getting closed correctly. They have advised "to contact a web-developer and check the website codes to see why the databases queries are not properly closing. You will need to optimize the database and codes to resolve the issue". (their words)
I have not made any changes or updates prior to the problem starting. I also have a duplicate on my home server that does not have this issue. The host uses cpanel and I can not see these 'sleeping' processes through mysql queries.
Searching is not turning up many good solutions, except raising the entry process limit (which is 20) and the host will not do that.
So I am a little stumped as to how to resolve the issue, any advice?
I think I have answered it myself. I got temporary ssh access and inspected live queries.
It was the Flickr module and the getimagesize() call timing out (which takes 2 minutes). Turns out it only uses this call for non-square image requests, so I have just displayed square images for now.
In progress issue here: https://www.drupal.org/node/2547171

Mediawiki Database Error 1205

I just installed a fresh copy of mediawiki on http://konton.us/wiki
I was all happy playing around with my wiki, filling up the place with information and suddently, when I created an article by the name of Gameplay_Mechanics, it all went dead.
http://konton.us/wiki/Gameplay_Mechanics
I got this error:
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "". Database returned error "1205: Lock wait timeout exceeded; try restarting transaction (internal-db.s76387.gridserver.com)".
I was able to fix it by 'emptying' the article and then saving it - only to repopulate it again but...it happened less than 1 day later...again, so I'm kind of wondering what is the ACTUAL ROOT CAUSE of this ridiculous error.
All help is appreciated
Try deleting the page, then recreating it with a slightly different name. It might just be a weird fluke thing having to do with that page specifically.
Are you using MySQL 5.1.26rc for a specific reason? Maybe upgrade to 5.1.49?
http://konton.us/wiki/Special:Version
This looks more like your database server being too busy. This error is often a sign of deadlocked transactions, although I'm not sure MediaWiki even uses transactions.
Are there many users visiting your site? Perhaps you're sharing your hosting with another high-traffic site?