Page 1 of 1

'Error: Commands out of sync; you can't run this command now

Posted: Sat Nov 19, 2011 4:27 am
by emaillenin
I have updated my WURFL db yesterday. Since then I am experiencing a problem.

My Version -

Tera-WURFL 2.1.5 Administration
Loaded WURFL: 2.3, db.scientiamobile.com - 2011-11-17 17:59:23

I have tried rebuilding the cache and clearing the cache also. (through the admin page).

My production system is down because of this problem. So, I have disabled the Tera-WURFL code as of now. Please find below the trace:

exception 'Exception' with message 'Error: Commands out of sync; you can't run this command now' in /var/www/libs/Tera-WURFL/DatabaseConnectors/TeraWurflDatabase_MySQL5.php:358
Stack trace:
#0 /var/www/libs/Tera-WURFL/TeraWurfl.php(292): TeraWurflDatabase_MySQL5->getDeviceFromCache('TeraWurflSimple...')
#1 /var/www/libs/Tera-WURFL/TeraWurfl.php(259): TeraWurfl->getDeviceCapabilitiesFromAgent('Mozilla/5.0 (co...', 'text/html, appl...')

#2 /var/www/Zend/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php(74): TeraWurfl->getDeviceCapabilitiesFromRequest(Array)
#3 /var/www/includes/mt_plugins/TargetDevicePlugin.php(25): Zend_Http_UserAgent_Features_Adapter_TeraWurfl::getFromRequest(Array, Array)
#4 /var/www/Zend/library/Zend/Controller/Plugin/Broker.php(237): TargetDevicePlugin->routeStartup(Object(Zend_Controller_Request_Http))
#5 /var/www/Zend/library/Zend/Controller/Front.php(908): Zend_Controller_Plugin_Broker->routeStartup(Object(Zend_Controller_Request_Http))
#6 /var/www/app/mt_boot.php(30): Zend_Controller_Front->dispatch()
#7 /var/www/index.php(8): Bootstrap::run()
#8 {main}

Re: 'Error: Commands out of sync; you can't run this command

Posted: Sat Nov 19, 2011 4:51 am
by emaillenin
I just dug through the source code. The following function is throwing the error.

Code: Select all


	// Cache Table Functions

	// should return (bool)false or the device array
	public function getDeviceFromCache($userAgent){
		$tablename = TeraWurflConfig::$TABLE_PREFIX.'Cache';
		$this->numQueries++;
		$res = $this->dbcon->query("SELECT * FROM `$tablename` WHERE `user_agent`=".$this->SQLPrep($userAgent));
		if(!$res) throw new Exception("Error: ".$this->dbcon->error);
		if($res->num_rows == 0){
			$res->close();
			//echo "[[UA NOT FOUND IN CACHE: $userAgent]]";
			return false;
		}
		$data = $res->fetch_assoc();
		$res->close();
		return unserialize($data['cache_data']);

	}
The following link might help

http://dev.mysql.com/doc/refman/5.0/en/ ... -sync.html

Re: 'Error: Commands out of sync; you can't run this command

Posted: Sat Nov 19, 2011 7:22 pm
by kamermans
Strange - can you tell me a little more about your environment, like what OS you're running and which version of PHP and MySQL you are using? Also, using the MySQL4 connector (in TeraWurflConfig.php) should work while I try to reproduce the problem. That connector works the with MySQL 4 or 5 but does not use stored procedures or queries with multiple result sets (which often cause the "Commands out of sync problem"). We will be releasing an update to the APIs (including the Database API) in the coming weeks that includes some improvements to the MySQL5 database connector and also includes a PDO MySQL connector that has been thoroughly tested.

Re: 'Error: Commands out of sync; you can't run this command

Posted: Sun Nov 20, 2011 12:37 am
by emaillenin
My OS - Ubuntu 11.04 (GNU/Linux 3.0.4-linode37 i686)
My PHP - PHP 5.3.5-1ubuntu7.3 with Suhosin-Patch (cli) (built: Oct 13 2011 21:56:07)
My MySQL - mysql Ver 14.14 Distrib 5.1.54, for debian-linux-gnu (i686) using readline 6.2

Hope this helps.

Re: 'Error: Commands out of sync; you can't run this command

Posted: Tue Dec 06, 2011 1:13 am
by thanhbui
We also have this problem.. We fixed this error by changing
public $db_implements_ris = true;
to
public $db_implements_ris = false;

This error seems to be fixed but another error is occurred on our server
"PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 71 bytes) in /opt/Vhosts/ad.aditic.net/Tera-Wurfl/TeraWurfl.php on line 338"

I changed : public static $MEMORY_LIMIT = "1024M"; in TeraWurflConfig.php

Please give me a help.. thanks alot!!

Re: 'Error: Commands out of sync; you can't run this command

Posted: Tue Dec 06, 2011 10:14 pm
by kamermans
We've got an updated version that should resolve both issues (MySQL Commands Out of Sync and Memory Limit) - I'll post a link to the release candidate tomorrow.

Re: 'Error: Commands out of sync; you can't run this command

Posted: Wed Nov 14, 2012 11:27 pm
by thanhbui
@Kamermans : Where can I download the updated? which version pls?

Re: 'Error: Commands out of sync; you can't run this command

Posted: Wed Nov 14, 2012 11:57 pm
by sm_support2
thanhbui wrote:@Kamermans : Where can I download the updated? which version pls?
http://www.scientiamobile.com/downloads

Thanks