Thursday, July 23, 2015

Wireshark can be a lie detector


   I used to trust Google Chrome browser and think it will never lie.  Today's experience changed my perception.

   I am testing an application with a web component.  When I clicked on a button, it felt the page is a little slow, so I opened the Chrome developer console.  It showed that downloading the content (in the JSON format) took 3 seconds.  I tried it a couple of times and it's always about 3 seconds.


     This worried me since I really don't expect it to take that long!  So I opened my wireshark to monitor the traffic between my browser and the web server.   To my surprise, the entire HTTP response completed within 1.08 seconds.



    I am using Google Chrome "Version 40.0.2214.111 (64-bit)" on my Ubuntu 12.04 PC.

    So I fired Firefox and ran the same test, it shows about 1.08 seconds which is very consistent with my wireshark reading:



    We all heard the famous quote "Trust but verify",  it's more true when it comes to browser.  Don't forget wireshark when you try to "verify"!

Wednesday, July 22, 2015

How GDB help with trouble shooting with my Google Chrome crashes


   I have been running Google Chrome (Version 40.0.2214.111 (64-bit)) on Ubuntu 12.04.   Recently my Google chrome starts crashing unexpectedly. What was worse:  when I restarted Chrome browser and clicked the "Restore" button, it ran for a moment (trying to recover all the tabs) and crashed again!   This repeats every time when I try to restore all my tabs.   It was so frustrating!

   Googled a lot and tried different remedies but none helped.   Finally figured out a way to restore most of my tabs.  Here is what I did

  • Start Chrome browser, it will have the button "Restore", don't click it yet!
  • Type Shift + Esc keys to bring up Chrome Task Manager. There should be multiple entries there,   find the processId for the Browser row (typically the first row),
  • In a terminal, type the following command:
    gdb -p <processId>      
  • Type "c" to continue
  • Now click the "Restore" button, wait a moment for all the tabs to recover.
     If it doesn't crash, congratulation!  You have "restored" all the tabs, you can type "ctrl-c" and "q" in the debugger to exit and continue to use your Chrome.  If it crashes again,  you will see it in the debugger window.  The browser window will not disappear thanks to the debugger.  Now you can see some tabs are still trying to recover (they have a spinning arc on that tab).  You would need to close those tabs.  Now type "q" in the debugger console to exit and retry the restoration process without the debugger.   For me, I lost 2 tabs among the 30+ tabs  but it's so much better than losing all the tabs!

    Hope this helps you trouble shooting your Chrome browser!