landsurveyorsunited / kml-samples

Automatically exported from code.google.com/p/kml-samples
0 stars 0 forks source link

Google Earth 5.0 crashes when Updating over network link #236

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which products are affected?

Google Earth 5.0

What steps will reproduce the problem?
1. Unzip attached file
2. Start running debugGE5.exe
3. Start running Google Earth 5.0
4. Drag-n-drop gecko.kml file to Google Earth
5. Wait several seconds for crash

What is the expected output or behavior? What do you see instead?

The expected output is a bunch of placemarks are created via a network link
update, and then deleted/changed/updated in a second update. Instead, I see
a crash. Running the exact same test on GE 4.2 doesn't cause a crash, but
instead the expected behavior.

What application versions (if any) are you using?

Google Earth Pro 5.0.11337.1968 (beta).

Which operating systems and browsers are affected?

Running on Windows XP Service Pack 3

Please provide any additional information (code snippets/links) below.

The included executable is a simple c# web server needed to demonstrate the
bug, since the only way to serve updates to a network link over time is
through a web server. You will need .NET run-time installed to run it.

Original issue reported on code.google.com by oddt...@gmail.com on 6 Feb 2009 at 11:48

Attachments:

GoogleCodeExporter commented 9 years ago
In case there is any concern about running the program provided, here is the 
source
C# code to go with it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;
using System.Net;
using System.Threading;

namespace debugGE5
{
    class Program
    {
        static private HttpListener listener = null;
        static private Thread serverThread = null;
        static private int updateCount = 0;

        static void Main(string[] args)
        {
            if (!HttpListener.IsSupported)
            {
                return;
            }

            listener = new HttpListener();

            listener.Prefixes.Add("http://*:9142/");

            listener.Start();

            if (serverThread == null)
            {
                serverThread = new Thread(listen);
                serverThread.Name = "GEServer";
                //Makes it so the application does not wait for this thread to finish
before it shuts down
                serverThread.IsBackground = true;
                serverThread.Start();
            }

            Console.WriteLine("Listening on http://*:9142/");

            Console.WriteLine("Drop gecko.kml onto GE 5 to initiate test");

            while (serverThread != null && serverThread.IsAlive && listener.IsListening)
            {
                System.Threading.Thread.Sleep(1000);
            }

        }

        static public void listen()
        {
            for (; ; )
            {
                // Note: The GetContext method blocks while waiting for a request. 
                try
                {
                    HttpListenerContext ctx = listener.GetContext();
                    ProcessRequest(ctx);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }

        static private void ProcessRequest(HttpListenerContext context)
        {
            try
            {
                string msg = context.Request.HttpMethod + " " + context.Request.Url;
                string hostName = context.Request.Url.Host;
                Console.WriteLine("Receive request " + msg);

                byte[] b;

                string url = msg.Replace("GET ", "");

                if (msg.Contains("initial"))
                {
                    StreamReader s = File.OpenText("initial.kml");

                    Console.WriteLine("Sending initial.kml");

                    b = Encoding.UTF8.GetBytes(s.ReadToEnd());

                    s.Close();
                }
                else // Anything else is considered an update
                {
                    StreamReader s;
                    try
                    {
                        s = File.OpenText("update" + updateCount + ".kml");
                        Console.WriteLine("Sending update" + updateCount + ".kml");
                    }
                    catch (Exception exs)
                    {
                        s = File.OpenText("updateEmpty.kml");
                        Console.WriteLine("Sending updateEmpty.kml");
                    }

                    b = Encoding.UTF8.GetBytes(s.ReadToEnd());

                    s.Close();

                    updateCount++;
                }

                context.Response.ContentLength64 = b.Length;
                context.Response.OutputStream.Write(b, 0, b.Length);
                context.Response.OutputStream.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error processing request: " + ex.Message);
            }
        }
    }
}

Original comment by oddt...@gmail.com on 9 Feb 2009 at 10:47

GoogleCodeExporter commented 9 years ago

Through more debugging, I've reduced the example KML data to the specific 
conditions
under which the crash occurrs.

Essentially any Create/Delete or Change/Delete of a Placemark feature within 
the same
Update and that involves the LookAt element of the Placemark causes the crash 
in 5.0,
but not 4.2.(Interestingly enough, modifying the Point element under the same
conditions didn't cause the crash)

The work-around in this case was to not do the Change if there was a Delete 
going to
happen later in the Update, or to remove both the Create and Delete if they 
occurred
in the same Update. 

The work-around is actually the optimal solution, since it saves on unnecessary
element Updates.

Original comment by oddt...@gmail.com on 10 Feb 2009 at 2:20