digitalmethodsinitiative / dmi-tcat

Digital Methods Initiative - Twitter Capture and Analysis Toolset
Apache License 2.0
367 stars 114 forks source link

'HY000: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' #386

Closed c3-antoine-qian closed 4 years ago

c3-antoine-qian commented 4 years ago

Hi, After successfully installing TCAT on an Amazon EC2 Ubuntu 18.04 machine as well as creating a query bin and visiting the analysis page, I find later that I cannot access the capture and analysis page anymore. The page is just blank with the same browser I used the first time (firefox), and gives me http 500 on chrome.

Here's an extract from my logs:

020-01-28 23:05:05 processing buffer before exit 2020-01-28 23:06:01 running php version 7.2.24-0ubuntu0.18.04.2 in mode cli with extensions Core,date,libxml,openssl,pcre,zlib,filter,hash,pcntl,Reflection,SPL,sodium,session,standard,mysqlnd,PDO,calendar,ctype,curl,mbstring,fileinfo,ftp,geos,gettext,iconv,json,exif,mysqli,pdo_mysql,Phar,posix,readline,shmop,sockets,sysvmsg,sysvsem,sysvshm,tokenizer,Zend OPcache (ini file: /etc/php/7.2/cli/php.ini) 2020-01-28 23:06:01 installing term signal handler for this script 2020-01-28 23:06:01 geoPHP library is fully functional 2020-01-28 23:06:01 started script track with pid 30274 2020-01-28 23:06:01 connecting to API socket 2020-01-28 23:06:01 connecting - query array ( 'track' => 'macron,climate change,climatechange,global warming,globalwarming,climate', ) 2020-01-29 00:41:36 insert into table climat_single_media failed with 'HY000: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away'

and

[Fri Jan 31 06:25:01.514675 2020] [mpm_prefork:notice] [pid 3652] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations [Fri Jan 31 06:25:01.514697 2020] [core:notice] [pid 3652] AH00094: Command line: '/usr/sbin/apache2' [Fri Jan 31 13:20:07.428112 2020] [php7:error] [pid 1330] [client 78.55.139.47:53649] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory in /var/www/dmi-tcat/common/functions.php:6\nStack trace:\n#0 /var/www/dmi-tcat/common/functions.php(6): PDO->construct('mysql:host=loca...', 'tcatdbuser', 'gPft2TYaRD4scZa...', Array)\n#1 /var/www/dmi-tcat/analysis/common/functions.php(9): pdo_connect()\n#2 /var/www/dmi-tcat/analysis/index.php(5): require_once('/var/www/dmi-tc...')\n#3 {main}\n thrown in /var/www/dmi-tcat/common/functions.php on line 6 [Fri Jan 31 13:20:13.080022 2020] [php7:error] [pid 1332] [client 78.55.139.47:53655] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory in /var/www/dmi-tcat/common/functions.php:6\nStack trace:\n#0 /var/www/dmi-tcat/common/functions.php(6): PDO->construct('mysql:host=loca...', 'tcatdbuser', 'gPft2TYaRD4scZa...', Array)\n#1 /var/www/dmi-tcat/analysis/common/functions.php(9): pdo_connect()\n#2 /var/www/dmi-tcat/analysis/index.php(5): require_once('/var/www/dmi-tc...')\n#3 {main}\n thrown in /var/www/dmi-tcat/common/functions.php on line 6

niczem commented 4 years ago

Please use the issue template for bugs for future bug reports.

SQLSTATE[HY000] [2002] No such file or directory means php cannot find the mysql.default_socket file.

together with

2020-01-29 00:41:36 insert into table climat_single_media failed with 'HY000: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away'

I would guess that the mysql server stopped running. Could you try to restart it by running:

sudo /etc/init.d/mysql restart

c3-antoine-qian commented 4 years ago

That fixed it, thanks