Pages

When not to put debug info on your production site

Title says it all.

http://outlet.lenovo.com/report/?id=-528847430&s=public

SQLSTATE[HY000]: General error: 5 Out of memory (Needed 25165796 bytes)
Trace:
#0 /chroot/home/lenovoco/lenovo.com/html/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /chroot/home/lenovoco/lenovo.com/html/lib/Zend/Db/Adapter/Abstract.php(457): Zend_Db_Statement->execute(Array)
#2 /chroot/home/lenovoco/lenovo.com/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(230): Zend_Db_Adapter_Abstract->query('SELECT COUNT(DI...', Array)
#3 /chroot/home/lenovoco/lenovo.com/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(281): Zend_Db_Adapter_Pdo_Abstract->query('SELECT COUNT(DI...', Array)
#4 /chroot/home/lenovoco/lenovo.com/html/lib/Zend/Db/Adapter/Abstract.php(761): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#5 /chroot/home/lenovoco/lenovo.com/html/lib/Varien/Data/Collection/Db.php(162): Zend_Db_Adapter_Abstract->fetchOne(Object(Varien_Db_Select), Array)
#6 /chroot/home/lenovoco/lenovo.com/html/lib/Varien/Data/Collection.php(188): Varien_Data_Collection_Db->getSize()
#7 /chroot/home/lenovoco/lenovo.com/html/lib/Varien/Data/Collection.php(174): Varien_Data_Collection->getLastPageNumber()
#8 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(928): Varien_Data_Collection->getCurPage()
#9 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(784): Mage_Eav_Model_Entity_Collection_Abstract->_loadEntities(false, false)
#10 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Catalog/Block/Product/List.php(167): Mage_Eav_Model_Entity_Collection_Abstract->load()
#11 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(642): Mage_Catalog_Block_Product_List->_beforeToHtml()
#12 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#13 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml('product_list', true)
#14 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Catalog/Block/Category/View.php(81): Mage_Core_Block_Abstract->getChildHtml('product_list')
#15 /chroot/home/lenovoco/lenovo.com/html/app/design/frontend/default/outlet/template/catalog/category/view.phtml(75): Mage_Catalog_Block_Category_View->getProductListHtml()
#16 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(144): include('/chroot/home/le...')
#17 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#18 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#19 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#20 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#21 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#22 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#23 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#24 /chroot/home/lenovoco/lenovo.com/html/app/design/frontend/default/outlet/template/page/3columns.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
#25 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(144): include('/chroot/home/le...')
#26 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(176): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#27 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Template.php(193): Mage_Core_Block_Template->renderView()
#28 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Block/Abstract.php(643): Mage_Core_Block_Template->_toHtml()
#29 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Model/Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#30 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(347): Mage_Core_Model_Layout->getOutput()
#31 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Catalog/controllers/CategoryController.php(115): Mage_Core_Controller_Varien_Action->renderLayout()
#32 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(376): Mage_Catalog_CategoryController->viewAction()
#33 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch('view')
#34 /chroot/home/lenovoco/lenovo.com/html/app/code/community/ArtsOnIT/OfflineMaintenance/Controller/Router/Standard.php(46): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#35 /chroot/home/lenovoco/lenovo.com/html/app/code/core/Mage/Core/Controller/Varien/Front.php(158): ArtsOnIT_OfflineMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#36 /chroot/home/lenovoco/lenovo.com/html/app/Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#37 /chroot/home/lenovoco/lenovo.com/html/index.php(65): Mage::run()
#38 {main}

Amazon’s MySQL and more EC instances

One of the major offerings from Amazon Web Service (AWS) is Simple DB, similar to Google’s bigtable, which is not a relational database. Some people have managed to migrated their applications to SDB in order to move their application to the Amazon cloud. Many other people who could not/would not convert their relational DB back-end to SDB installed MySQL on the EC2 instances instead, then again, they started to worry about how to persist the data directory on Amazon EBS. It was some additional pain indeed.

Nice thing is that Amazon today announced Amazon Relational DB Service(rdf), based on MySQL. Now people do not have to google the “best practice” to persist on EBS without compromising performance. Hopefully this will drive more people to Amazon’s AWS.

Chrome 4.0.222.5 for Mac released

If you are on the dev channel, your Chrome will be upgraded automatically.

There are some new features as well as some bugfixes. New features include enabling “Edit Search Engine” menu item,  and “default browser”.

Performance-wise, it seems this version has a smaller toll on the CPU compared to previous ones.

Windows 7 Visualization on Mac OS X

Apple Inc.
Image via Wikipedia

Since I got my first Macbook Pro one week ago, the overall experience has been pretty positive. One of most impressive feature I like is quick switch from/to sleep mode. In Windows (and Linux) it usually takes more than 10 seconds but it takes than 1 second on Mac OS. When I touch the touchpad, the computer wakes up from sleep and becomes up-and-running almost instantly.

Apple computers are great. But sometimes you just could not find your favorite app on a Mac, MS Visio being one of them. When you do not want to switch to a different machine, you have options – visualization. There are several different products on the market – VMWare Fusion 2 and VirtualBox 3 being the most popular.

Both of them have some nice feature sets. I like “Unity” mode in Fusion (the counterpart in VirtualBox is called “seamless mode”). VMWare has more interesting integrations, such as mirroring Mac home directory, iSight under Windows, to name a few. VirtualBox, on the other hand, is more configurable via the command line.

However, VMWare Fusion does not support Windows 7 yet, at least officially. The official Fusion blog suggested to use “Windows Server 2008″ as the profile when installing Windows 7 beta and RC. As a result, the above nice features are not available – home directory mirroring and iSight under Windows. In this case, Dropbox will be helpful if you want to share documents between these OSes.

Performance-wise, VirtualBox seems to be the winner. Windows applications in VirtualBox (MS Office 2007 and Visio) are more responsive and the host OS is not slowed down by any means. Windows apps in Fusion feel a little bit sluggish, given the same configuration (1G of physical mem). Please note, these are not really scientific performance analysis – they are totally my subjective feeling of “responsiveness”.

In summary, Fusion 2 and VirtualBox 3 are both great products. I am hoping when Windows 7 is officially released, VMWare Fusion will have more integration with it. Oh BTW, Fusion costs $70 and Virtualbox is free for personal use.

Migrating to Phusion Passenger

I have been using nginx and mongrel for my rails application on my 256 slice. It has been nice, except administration is becoming a big overhead when considering all the stuff I had to deal with fastcgi scripts for my other PHP applications/domains. 

I liked nginx because of its small footprint, and high performance. However when the administrative cost is getting higher, I start to look for alternatives.

Passenger is nice because of its low administrative overhead. But it does not come cheap – it is a module for apache, meaning I will need to run Apache as my web server. Considering the fact the slice has only 256M memory, it is a hard decision to get rid of nginx and bring back Apache.

Things I had to work on is the MPM portion of Apache configuration. My stock Apache from CentOS uses prefork MPM as the default MPM. When using the default configuration, Apache started too many spare servers which uses substantial amount of memory. As a result, the system was put into swap whenever there is a HTTP request. After lowering MaxSpareServers to 6, Apache and Passenger are doing fine. Swap is never used again and the applications are more responsive. 

Now I am happy.