14 Replies Latest reply on Jun 26, 2014 6:43 PM by Jon Tara

    Updated from 4.0 to 4.1 and now application is freezing on MC95

    Chris Child

      I don't have anything in the log file that seems to be of relevance other than this:

      E 06/23/2014 11:49:15:000 8c2fe5c6 EngineInterface.cpp:1630| Message from ..\neon\Helium\HeliumForWindows\Implementation\Engine\OutProcessLauncher\EngineInterface.cpp:CEngineInterface::ReceiveThread - Engine timeout. Sending ENGINE_EXIT EventLine: 549

       

      This is the only error message I see and it has been logged 5-6 times but I have no idea what is timing out and nothing in the log files to suggest what is timing out.

       

      Thanks

       

      Chris

       

      edit: I am continuing to receive E 06/23/2014 11:49:15:000 8c2fe5c6 EngineInterface.cpp:1630| Message from ..\neon\Helium\HeliumForWindows\Implementation\Engine\OutProcessLauncher\EngineInterface.cpp:CEngineInterface::ReceiveThread - Engine timeout. Sending ENGINE_EXIT EventLine: 549 while the application is frozen.

       

      I've attached my log file but nothing is jumping out at me.

        • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
          Kutir Mobility

          Hi Chris,

          This issue needs help from Motorola. We will raise this issue with them to get an answer.

           

          Visnupriya R

          Kutir Mobility

          • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
            Joydeep Chakraborty

            Engine is getting timed out(60 sec is timeout) here.

            What exactly you are doing in the page?ICan you share your page/source code of you app?s there any alert or something which is halting the execution of the engine?

              • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                Chris Child

                This previously worked for 4.0 and I can run it in the 4.1 Rho Simulator without running into any issues. I don't know if these forums are going to show my code nicely but here it is.

                 

                <code>

                <head>

                    <link rel="stylesheet" type="text/css" href="/public/css/layout.css">

                    <script type="text/javascript" src="/public/jquery/jquery-1.9.1.min.js"></script>

                    <script type="text/javascript" src="/public/jquery/jquery.json-2.4.min.js"></script>

                    <script type="text/javascript" charset="utf-8" src="/public/api/rhoapi-modules.js"></script>

                    <script type="text/javascript" charset="utf-8" src="/public/api/rhoapi-modules-ORM.js"></script>

                    <script type="text/javascript" src="/public/js/mytest.js"></script>

                    <script type="text/javascript" charset="utf-8" src="/public/js/components/user.js"></script>

                    <script type="text/javascript">

                      

                        $(document).ready(function() {

                            MyTest.Samples.User.createUserModel();

                            var userModel = Rho.ORM.getModel("User");

                            var users = userModel.find('all');

                          

                            for (var i = 0; i < users.length; i++) {

                                if (users[i].get("activeUser") == 1) {

                                    users[i].updateAttributes( { activeUser : 0 } );

                                }

                            }

                        });

                      

                        function login() {

                            var username = document.getElementById("username").value;

                            var password = document.getElementById("password").value;

                          

                            var validLocal = MyTest.Samples.User.localLogin(username, password);

                          

                            if (validLocal) {

                                window.location = '/public/sync.html';

                            } else {

                                var getProps = {

                                    url: "http://someurl?method=login",

                                    headers: {},

                                    body: "&username=" + username + "&password=" + password

                                    };

                                  

                                Rho.Network.post(getProps, sync_callback);

                            }

                        }

                      

                        function sync_callback(params) {

                            var body = params.body;

                            var username = document.getElementById("username").value;

                            if (body.replace(/(\r\n|\n|\r)/gm,"") === "Authentication failed for user: " + username) {

                                alert(body);

                            } else {

                                MyTest.Samples.User.saveUser(username, document.getElementById("password").value);

                                window.location = '/public/sync.html';

                            }

                        }

                      

                        function quit() {

                            Rho.Application.quit();

                        }

                      

                    </script>

                </head>

                <body id="background">

                    <div id="holder">

                        <div id="body">

                            <table>

                                <tr>

                                    <td>

                                        <label for="username">Username:</label>

                                        <input type="text" class="input" id="username" class="data" />

                                    </td>

                                    <td>

                                        <p style="color:red" id="usernameError"></p>

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                        <label for="password">Password:</label>

                                        <input type="password" class="input" id="password" class="data" />

                                    </td>

                                    <td>

                                        <p style="color:red" id="passwordError"></p>

                                    </td>

                                </tr>

                            </table>

                            <div id="footer">

                                <table>

                                    <tr>

                                        <td>

                                            <button class="button" onclick="login();">Login</button>

                                        </td>

                                        <td style="text-align:right;">

                                            <button class="button" onclick="quit();">Quit</button>

                                        </td>

                                    </tr>

                                </table>

                            </div>

                        </div>

                    </div>

                </body>

                </code>

              • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                Jon Tara

                I'm sure some Rhodes folks will disagree with me on this one, but I'd avoid the Javascript ORM unless there is some compelling reason to use it. In fact, it's best to avoid the Javascript APIs altogether. Javascript in a WebView is a poor performer vs. Ruby. You are using jQuery Mobile, which is really the biggest performance drag in Rhodes (of course, you do not have to use jQuery Mobile...) and then weighing-down the WebView with loads more Javascript.

                 

                It's certainly convenient for some Motorola legacy customers who are used to working in a Javascript environment. And I suppose it will allow you to create a small project while avoiding learning Ruby.

                 

                I see you are setting window.location. Keep in mind that that will re-load the entire document! It will reload jQuery, jQuery Mobile, your CSS, etc. and re-initialized everything in Javascript. That means your $(document).ready (which really shouldn't be used if you are using jQuery Mobile) will fire again, and I doubt that is what you'd intended.

                 

                I also notice you are mixing-up native browser methods (e.g. getElementByID) with jQuery. If you are using jQuery, use jQuery! There are some nasty edge cases where this will get you unexpected results. jQuery is there to provide a browser-neutral way of manipulating documents. If you use the native methods, you've defeated one of the main purposes of using jQuery.

                  • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                    Chris Child

                    For the immediate future we are going to work with Javascript but I'm hoping at some point I will have time to learn ruby for my own benefit as well as for developing in Rho. Thank you for the constructive comments, this is the first app I've made in Rho and I haven't touched this much javascript in the last 5 years so this is all new.

                    • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                      Mark Nongkhlaw

                      I'm sure some Rhodes folks will disagree with me on this one, but I'd avoid the Javascript ORM unless there is some compelling reason to use it. In fact, it's best to avoid the Javascript APIs altogether...

                       

                      It's certainly convenient for some Motorola legacy customers who are used to working in a Javascript environment. And I suppose it will allow you to create a small project while avoiding learning Ruby.

                       

                       

                      Hi Jon, While I fully agree with you about the performance issues when using JS APIs and JQM especially with devices with low memory, what will we do when some APIs (especially the more recent ones) are only available in JS? It seems to me that since most of the new and upcoming Moto devices are on Android (and with more memory), maybe Moto's strategy is to avoid Ruby altogether and focus on JS in the long run. However, I may be wrong in this assumption and I'd be glad if the Moto guys can correct me if I am.

                       

                      And there's more to it--Some of us have invested our time and efforts in learning Ruby. Going forward, if Moto is only going to support JS APIs, then our investments would go wasted. That would also be annoying to say the least.

                        • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                          Jon Tara

                          Mark, I don't think that's a concern. The JS API's just make Ajax calls to the Ruby code for implementation. It's just adding an extra layer. I doubt Motorola has any plans to ditch Ruby.

                           

                          I think where Ruby is actually being bypassed, it's user-driven - some developers are using a javascript MVC and at that point you have to ask yourself why you are even using Rhodes? (Answer might  be simply to be able to access device features.) Save support for device-specific (Motorola device) features, if you go in this direction, you might as well just use PhoneGap.

                           

                          BTW, while we use Ruby for our models and controllers (and ERB for views), I, too, haven't touched this much Javascript in 5 years! There's plenty of Javascript to go around, just handling UI features.

                           

                          The performance issue is counter-intuitive. Ruby is considered by most to be a "slow" language. Ruby got a boost and then a slap in the face from it's association with Twitter. (Twitter was once run on an all-Ruby backend. But Twitter's volume eventually got the best of Ruby, quite some time ago. Twitter Search is Now 3x Faster | Twitter Blogs) But Ruby vs. Javascript? No contest.

                      • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                        Chris Child

                        I believe I've come to a conclusion and it is that our device doesn't have enough memory to load all of the js files. I removed the ORM javascript file and still had an occasional freeze sometimes but the second I re-add the ORM javascript it fails loading that 100% of the time. I did go ahead and fix some of the issues that were brought up in Jon Tara's comments which also did not help. We're going to be speaking with Motorola very soon so hopefully we can get an answer from them on how this can be solved without having to revert to 4.0.

                          • Re: Updated from 4.0 to 4.1 and now application is freezing on MC95
                            Jon Tara

                            Just noticed that you are *not* using jQuery Mobile - just jQuery. This is a good thing!

                             

                            From what I've read here, these devices offer a challenging environment vs. iOS and Android devices. They typically have limited memory and browsers/webviews may not be up to the latest capabilities.

                             

                            Since you are not using jQuery Mobile please ignore my comments regarding window.location and $(document).ready.

                             

                            There is no reason not to update to the latest jQuery, then, BTW. If this is an IE browser, make sure to use the latest of the 1.11 series, not 2.1.x. There is a jQuery Download Builder that might be able to give you a slimmed-down jQuery, though I doubt that would help that much.

                             

                            It might help to combine and minify your CSS and your JS.

                             

                            The more you can push stuff out of Javascript and into Ruby on these devices, the happier you will be, IMO.

                             

                            Something like Bootstrap would be appropriate if you want some nice styling without the overhead of jQuery Mobile.