Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
2.3k views
in Q2A Core by
edited by

Hi guys. I found an new error. My Q2a site working well , But  suddenly an issue begins at plugin page on admin-panel section.

in plugin page when I clicked to option it loading and finally showing an 503 error message

The error message is shown below

 Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Additionally, a 503 Service Temporarily Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
 

and it redirected to an URL with the above 503 error message

http://myq2asite.com/index.php?qa=admin&qa_1=plugins&show=822de3226d859beeb5815497a8f3c4e2#822de3226d859beeb5815497a8f3c4e2

But in the errorlog file shows an mysql error. that is also shown below

[2014 04:42:43 Etc/GMT] PHP Question2Answer MySQL query error 2006: MySQL server has gone away - Query: (SELECT 'options' AS selectkey, title, content FROM qa_options) UNION ALL (SELECT 'time', 'db_time', UNIX_TIMESTAMP(NOW()))

Actually what was the exact issue and how to fix this issue. Please help as soon as possible

Thanks ...

 

 

EDIT ON 30.10.2014

I wrote a custom query to fetch the details of qa-option table in index.php. And getting the data from that table without any issues.

 The query is

 $sql = "(
SELECT 'options' AS selectkey, title, content
FROM qa_options
)
UNION ALL (

SELECT 'time', 'db_time', UNIX_TIMESTAMP( NOW( ) )
)";

if (!$sql) {
    die('Invalid query: ' . mysql_error());
}
$retval = mysql_query($sql);
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
else
{

echo ' got the data';

}

And I got the values. So only problem when the admin page option button. So what was the issue on my q2a site option button. Is there any file missing Or any other issue.

Thanks

 

Q2A version: version 1.6.3
by
Hmm... there is no valid reason for a query to the options table to break in the admin page and not in any other page. Actually, the admin page is one of the lightest ones in terms of DB access (compared to the question list, for instance). I would copy the whole SQL statement that breaks. Run it against the DB. Analyse the result (for instance, how many records are returned or how many milliseconds it takes). After finding out that it should be around a few hundred results and a few milliseconds I would ask the hosting provider for an explanation on why such a simple query that returns so little results is timing out. It should only take milliseconds, even in old hardware.
by
Hai , I wrote a custom query on index.php and it works well. Please look my post I edited for new updates
by
edited by
@ pupi : Thanks for supporting me :)

 I deleted all the third party plugins. Now its working well.
But after restoring it again showing the same issue :(
by
1. Check if you have 2 fields/columns called "oemail" and "ohandle" in your ^userlogins table. Also check if you an "oemail" column in your ^users table. Confirm the 3 of them.

2. If the answer is NO for the 3 of them then also let me know if you have ALTER privilege with your MySQL user.

3. What is your "QA_MYSQL_TABLE_PREFIX" ? You can find it in qa-config.php file and it is usually "qa_"

3 Answers

+3 votes
by
selected by
 
Best answer

It may be issue related to init_queries(). qa-include/qa-page-admin-plugins.php (around L81)

foreach ($moduletypes as $type) {
  $modules=qa_load_modules_with($type, 'init_queries');
  foreach ($modules as $name => $module) {
    $queries=$module->init_queries($tables);
      if (!empty($queries)) {
        if (qa_is_http_post())
          qa_redirect('install');
        else
          $qa_content['error']=strtr(qa_lang_html('admin/module_x_database_init'), array(
            '^1' => qa_html($name),
            '^2' => qa_html($type),
            '^3' => '<a href="'.qa_path_html('install').'">',
            '^4' => '</a>',
          ));
    }
  }
}

Check method:

  1. Once all remove all third-party plugins from your qa-plugin folder
  2. Check 403 error after you restore one by one
by
Yes bro after deleting all third party plugins, It works smoothly.
by
How to check after restore . Please help. Because after restore it seems again the same issue
I did not get the 403 checking method. Please tell
Thanks...
by
Are you restore the plugin "one by one" ?
Is phenomenon same in any plugin?
by
@ sama55 : Yes, You are correct. :)
 I deleted all the third party plugins. third party plugins used in my site

1) q2a-open-login-master
2) q2a-custom-404-page-master

and added one plugin first q2a-custom-404-page-master. same issue occurs.
So deleted and uploaded q2a-open-login-master. It working so It may be the issue of q2a-custom-404-page-master right?.

Thanks for the support
+2 votes
by

Have a look at this article .

I would check first if you are in the 3rd situation, that is "if you send a query to the server that is incorrect or too large"

If your website is not in production (that is your users are not accessing to it) , you could make this change in the qa-config.php file :

from :

define('QA_DEBUG_PERFORMANCE', false);

to :

define('QA_DEBUG_PERFORMANCE', true);

and see if you get more infos on what's happening when you click on the "option" link.

EDIT : I've corrected "true" and "false", I had reversed them :-)

by
edited by
*in this question* issue not solved. I cant edit any value from admin forms. Now I am updating through Database via workbench.
But after deleting qa-open-login-master (third party plugin). It will working fine
by
Again : deleting plugins is not a solution. You should find the issue and solve it.
by
yes it may be the server issue. I am using sharing host . I worked last previous two weeks without any issues. But last week suddenly found this issue. I think it may be some server isssue. What do you think about this issue . Any suggestions

Thanks
by
You did not provide any details....
However it looks like to be a different issue from the one you was talking about in this question, so I think you should open another question, or, if you think so, you could "ask a related question".
But if I were in you I would solve first the connectivity problems that you have on your server.
See : http://www.question2answer.org/qa/40150/q2a-open-login-are-not-working-on-my-site-now?show=40164#c40164
+1 vote
by
edited by

1. System configuration

If your web server (Apache, NginX, etc) and database server (MySQL) exist on the same server (hardware), you should try to changing system parameter of qa-config.php (around L166). This change reduces the load on your server, and performance of your site will be improved. As a result, you may be able to avoid the phenomenon.

Before (Current setting):

define('QA_OPTIMIZE_LOCAL_DB', false);

After:

define('QA_OPTIMIZE_LOCAL_DB', true);

2. Size of your qa_options table

You should change again the system configuration of the qa-config.php according to the advice of maxj. And, report the number of records of qa_options table on your debug panel (bottom of page). If this number is very large (more than 5000, 10000, 100000, etc), you might need to remove the unnecessary records in the qa_options table.

Before (Current setting):

define('QA_DEBUG_PERFORMANCE', false);

After:

define('QA_DEBUG_PERFORMANCE', true);

Example of debug panel:

SELECT title, content FROM qa_options
13.31 ms - 1841 rows - 2 columns

3. MySQL configuration

If you are using VPS or dedicated server, you need to check MySQL configuration below (my.cnf). You may be able to check these settings in phpMyAdmin.

max_allowed_packet
read_buffer_size
max_used_connections
etc ...

http://forums.mysql.com/read.php?22,593241,593241

by
Ok I am going to try. Please help ... Thanks
by
Hai , I wrote a custom query on index.php and it works well. Please look my post I edited for new updates
by
I got it. Refer also to my next answer.
...