Wednesday 18 December 2013

More Chrome Debugging Tools: plugins and conflicts



So I've been meaning to share more about my work with Unity3D in regards to simulations. This gets to be where I talk about the potential pitfalls of using Unity on the web. Many will take this as a knock at Unity but that's not really fair. What I am sharing is the new debugging tools I have found in chrome to help when you find a plugin that's gone rogue. If, like me making reliable, quality web applications is your livelihood it never helps to find a new tool to help you raise quality and for me that's most often about debugging. Debugging is in my blood.

This post came about because I just had multiple tabs in chrome crash repeatedly. That's rare. Chrome is very stable for me. The same happened yesterday. When it starts to be a consistent problem I prefer to understand why and improve my knowledge in the process. It all started today when I read about kahoot and I signed up, the trouble started when I went to checkout out their facebook community. The community page never stopped loading. Normally a sign that something is unresolved. Eventually it crashed and all those connected to it.

Stopping Flash and Unity crashing your browser is for another post. Right now I wanted to share how to disable any plugin right in chrome and also check if there are any software conflicts that might be causing problems. This functionality exists as two pages chrome://plugins/ and chrome://conflicts/.

chrome://plugins/

chrome://plugins/ is a page when you can Easily disable/enable plugins and reload tabs. I discovered it reading How To: Solve your Google Chrome Freezing and Hanging Problems referred to by the Google forum thread Facebook freezing in Chrome 

I followed the advice an voila I could load all three tabs described earlier without problems. The only difference is that I disable both flash plugins I had installed and the unity plugin. Just disabling Flash wasn't enough. I couldn't prove it was a Unity fault because when I subsequently enabled all the plugins and reloaded the tabs they all worked fine. Yep you can guess I test, test and then retest. The point is that I now have even more tools to help me debug these issues and enjoy the web. If I just have to disable then re enable a plugin to make chrome work it's now just a page away. Pretty darn useful I'd say

chrome://conflicts

I also learnt about chrome://conflicts/ in software the crashes chrome. The title of the page is  'Modules loaded into Google Chrome'
and its description is
This page lists all modules loaded into the main process and modules registered to load at a later point.

For me it didn't list any conflicts so I can't tell you what happens when it does. What it did teach me is that the number and type of dlls and apps chrome uses is far higher and wider than I imagined. For example tortoisesvn was listed as was sophos antivirus.

I couldn't actually do anything on this page you can just do things with the information. So I share it simply for reference.

I hope this helps. Shame I couldn't share all the cool things you can do with Unity on the web. I do have posts lined up for that though. Just hope this helps you as much as it did me.

Reference

There is more detail I would like to include but it is aside from the main point of this article which is about useful new debugging tools I found. I've included it here for those who might find it useful. 

Why do multiple Chrome tabs crash together?

If you thought each chrome tab is supposed to be its own independent tab I've learnt from experience that this isn't totally true. It seems there are parent threads and child threads. If you type the address in directly then you start a new parent thread. Any tab you open from the parent tab creates a child tab. I do this all the time. Each page I linked to in the previous paragraph I opened in turn in a new tab. All three crashed when the community page crashed. This is typical chrome behaviour for me. All other tabs and windows were unaffected.

Why do Flash and Unity Plugins suffer the same problems?

Unity suffers many of the problems of Flash in that it is doing things on the web that html and the browser struggle with. Whenever you find examples of html trying to do even simple version of things done in Unity html (these days HTML5, the new darling!!!) has far more problems than Unity. Either it won't even work or it will crash the browser even worse than Unity.

The problem for Unity and Flash is that neither have done anything to help their image. The reasons for their bad reputation of reliability on the web is a common issue for any plugin that they could address. Basically Unity gets full access to various parts of a users machine. N.B this is intended as a technical post. I am assuming you understand the principles of designing software to run with full permissions and won't run away screaming that Unity and all followers are the devil incarnate.

The average user runs all software with full access to much of their machine and runs this risk all the time. Any software run this way will be less reliable because it can cause problems due to this elevated level of privilege. Browser are simply a new way to run applications and they prefer to use html and css for user interface and javascript for functionality (a gross simplification). They don't allow direct access to the graphics card or CPU and thus all web pages suffer in performance because they are essentially treated like children who can't be trusted. That's fine. HTML and the web is very young. It is suffering from the normal problems of immaturity.

Unity and Flash however bypass this built in sandbox type security of the web model. That is both a blessing and a curse. Flash was banned from Apples iOS because it didn't respect the new standards the internet is trying to set. e.g. security and performance. Flash is the main reason a browser crashes. Unity is now reaching the same height of unreliability for me both because I search out unity resources because I love Unity and also because others love Unity too. Companies like Facebook who have built a business around games. They adopted flash early on and so they are doing the same with Unity. The problem then is that any poorly built Unity app can now crash your browser.

Why are plugins better supported?

My question is why Unity aren't doing more to prevent this. Google and the web browser community are avidly against plugins for this very reason. Yet plugins are important simply because they bridge the gap between what browser can do well and what users want them to do. Every person I talk to about Unity say I should use HTML 5 instead. All this does it highlight their naivety of HTML 5 and Unity. They think what unity does is simple. It is incredibly complex much more complex than delivering a browser.

So Unity, like all 3d and simulation engines, is incredibly advanced in what it does. Generally it uses established older technologies in new ways. Hence it doesn't speak HTML. That's because HTML is new and hasn't learn 3d properly yet. Sure there are lots of 3d examples but they are all just tiny, simple prototypes. None are a fully fledged real time connected application. That's what Unity delivers. HTML 5 can't deliver that.

I have explained a little about why elsewhere on this blog but it is an in depth issue. The point is still that HTML and the browser model is still very immature compared to the older app model that came before it. Users still want the old app level of functionality. If that were not possible in browsers they just wouldn't have grown as quickly as they have. So browsers beed plugins or they need to provide reliable alternatives. HTML 5 a canvas isn't enough. There is so much more that Unity does and browsers aren't providing it.

Anywho. I need to move this debate into its own article at some point. For now. I will just share and see what you think.

No comments: