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

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

Postby emaillenin » Sat Nov 19, 2011 4:27 am

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}
emaillenin
 
Posts: 10
Joined: Sat Aug 20, 2011 3:37 pm

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

Postby emaillenin » Sat Nov 19, 2011 4:51 am

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/commands-out-of-sync.html
emaillenin
 
Posts: 10
Joined: Sat Aug 20, 2011 3:37 pm

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

Postby kamermans » Sat Nov 19, 2011 7:22 pm

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.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
kamermans
 
Posts: 383
Joined: Mon Jun 06, 2011 9:50 am

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

Postby emaillenin » Sun Nov 20, 2011 12:37 am

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.
emaillenin
 
Posts: 10
Joined: Sat Aug 20, 2011 3:37 pm

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

Postby thanhbui » Tue Dec 06, 2011 1:13 am

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!!
thanhbui
 
Posts: 4
Joined: Tue Dec 06, 2011 1:03 am

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

Postby kamermans » Tue Dec 06, 2011 10:14 pm

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.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!
kamermans
 
Posts: 383
Joined: Mon Jun 06, 2011 9:50 am

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

Postby thanhbui » Wed Nov 14, 2012 11:27 pm

@Kamermans : Where can I download the updated? which version pls?
thanhbui
 
Posts: 4
Joined: Tue Dec 06, 2011 1:03 am

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

Postby sm_support2 » Wed Nov 14, 2012 11:57 pm

thanhbui wrote:@Kamermans : Where can I download the updated? which version pls?


http://www.scientiamobile.com/downloads

Thanks
sm_support2
 
Posts: 274
Joined: Mon Jun 20, 2011 5:04 pm


Return to PHP API

Who is online

Users browsing this forum: No registered users and 1 guest

cron