Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
4.1k 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
No specials found. same errors repeating. Any idea how to solve
by
What's the plugin ?
You should isolate the exact point in the code that is failing.
by
I didn't get you. What I can do for tracking to find the exact issue. Actually almost plugin do the same issue including small plugin : reCaptcha too. How should Isolate the cose .Will you please specify, Please help me.
Thanks....
by
I've not clear exactly your situation : do you have the issue on EVERY plugin or ONLY on 1 plugin ?
by
Yes I have the issue with all plugins. But all question lists. If there is any mysql error how it possible to list large content( Questions). Only the problem exists in qa_option table. I am totally confused
by
Hai , I wrote a custom query on index.php and it works well. Please look my post I edited for new updates
by
Are you on a shared hosting or on a VPS ?
by
nope the issue of init_queries(). I deleted all the third party plugins. Now its working well.

@maxjtechno Thanks for supporting me :)
by
Ok . But sincerely I do not think that *deleting all third party plugins* is "the solution ". You should understand "why" it was happening....
Try for instance to apply the second step that sama55 suggested to you.
by
yes. But last three days I am seeking to find the solution for this. But after restoring the third party plugin , again showing the same error.
by
So we are saying the same thing...
Your issue is not solved :-)
You've just "avoided" it.
If you have an issue for instance in your mysql setup, that's still there.....
What I mean is that the issue could manifest itself somewhere else.
by
how can find the issue. Is there any need to look the Size of  qa_options table. Are you suggesting this ?
by
do you have another installation of your website  where *you do not have the issue* with your third party plugins ? I mean, a testing environment, separate (different mysql) from your production environment.
I would put this this php :
https://www.dropbox.com/s/ea9zwjya3vctny9/testmysql.php?dl=0
in your q2a docroot and run it :
http://www.yourq2asite.com/testmysql.php
on both environments (test, where you do not have the issue, and production, where you have the issue).
It just shows the value of the mysql system variable you are using (it should not require any particular privilege)
After that I would compare the most "suspected" parameters...
If you do not have a test environment just run it on a production environment... but we'll have to guess :-)
by
yes no test server. which values are needed. There are actually 200 rows or more. Tell me which of them are needed. THANKS
by
all those that begin with "max" and all those that end with "timeout"
1) max_%
2) %timeout
by
max_allowed_packet:67108864
max_binlog_cache_size:18446744073709547520
max_binlog_size:1073741824
max_connect_errors:10
max_connections:400
max_delayed_threads:20
max_error_count:64
max_heap_table_size:67108864
max_insert_delayed_threads:20
max_join_size:18446744073709551615
max_length_for_sort_data:1024
max_long_data_size:67108864
max_prepared_stmt_count:16382
max_relay_log_size:0
max_seeks_for_key:18446744073709551615
max_sort_length:1024
max_sp_recursion_depth:0
max_tmp_tables:32
max_user_connections:5
max_write_lock_count:18446744073709551615
connect_timeout:60
delayed_insert_timeout:300
innodb_lock_wait_timeout:50
innodb_rollback_on_timeout:OFF
interactive_timeout:3600
net_read_timeout:30
net_write_timeout:60
slave_net_timeout:3600
table_lock_wait_timeout:50
wait_timeout:600
by
do you know your mysql version ?
by
MySQL server version: 5.1.66-rel14.1-log
by
1) run this  and let me know the output :
https://www.dropbox.com/s/2aqipjxlglcny3m/testwait.php?dl=0
put it in your q2a docroot :
http://www.yourq2awebsite.com/testwait.php

2) can you list ALL the additional third party plugins that you are using ?

3) have you tried what sama55 wrote to you ? (restore the plugins ONE BY ONE)
- remove all the plugins
- restore 1 of them
- click "options" and see what happens
- restore another one
- click "options" and see what happens
- and so on......
(pls reply to sama55.....)
by
@maxjtechno :  Yup its issue of a third party plugin - q2a-custom-404-page-master.
Thanks  for your support
by
Ok, select sama55's answer ....and .... give more detailed infos next time ! :-) :-)
by
edited by
AFter executing testwait.php

run 1 : 07:16:54
run 2 : 07:17:04
by
Thanks, that was useful in case you had the issue on *all* the plugins
by
@ maxjtechno : Actually the issue is not solved yet. And I had an issue with all plugin now :(
by
You mean that the issue you wrote about *in this question* is not solved, or are you  talking about another (different) issue ?
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.
...