Answer of QUIZ: How many SilverLight4 applications on a web page will crash inexplicably? What is it about?

Source: Internet
Author: User

Answer: It depends.

 

"You go to shit !"

I guess someone will say that. Since"

Another day, I also published an article "QUIZ: How many articles a garden user sends to a question? I still read my mood to answer the question. This will cause the garden friends to crash, why? "put it on the homepage."Such a reply, the above idea is certainly inevitable. Well, let me be a little spoiler: This crash is related to the word in it, and also to your profession.

 

"Rely on, how is this possible? You just say it's a good character !" Well, if you really think so, I have to say, as for whether you believe it or not, I believe it.

In fact, the reason why I sent these QUIZ messages is that I found some interesting problems. I hope you can experiment with them. However, the garden level is really poor, and it seems that there are not many people who are willing to explore its roots. This is also a phenomenon I found at work. Many people are "unaware of it" and feel at ease. Well, the complaint is over. Let's talk about this amazing crash.

 

We found a strange crash in our work: (Sorry, nothing, not clearly described, because this is not my job, there is no first-hand information .)

1. Some people's machines will always crash, No matter what browser they use, and others will never be able to reproduce;

2. For machines that will crash, it will crash at the beginning of some pages. In particular, IE7 will pop up a Red Cross dialog box, which contains a string of hexadecimal numbers, displaying something similar to Access denied similar to C ++ error prompts .. NET should be managed securely. How can this happen?

3. For the moment before the crash, neither the memory used nor the CPU load was abnormal.

We even made a Dump for the above questions. At the beginning, we thought it was a COM component error in IE7, this is because when the WinDbg is used to see the error, the stack is located after the size of the IE window changes. However, the subsequent findings prove that this is not the case at all, because someone did an experiment and found that the crash was related to the number of SilverLight applications on the same page. The preceding conditions are necessary but inadequate, because on the same machine, some pages do not crash, and some pages will crash. The difference is that the former has only one SilverLight application, while the latter loads and displays four applications at the same time.

 

But this does not explain why some machines crash, and some do not. We have made a lot of assumptions about this problem, such as the system memory size, operating system version, browser version, memory leakage, improper handling of exceptions, and various thread security issues, the core versions of SilverLight are inconsistent, the development version and the common user version, and so on. As the previous serious doubts were ruled out one by one, we even laughed at the issue of character. Because we have never encountered this problem during development, but when using it internally, some artists and designers will encounter this embarrassing situation, in addition, no developer can use his own development environment to reproduce this problem. Some people even downloaded Silverlight 5 Beta and found that the critical value was changed from 4 to 5. This result is a bit of a joke: there are changes, but it cannot be explained.

Just as we couldn't do anything, this colleague made another simplified experiment: At the same time, he showed four completely identical SilverLight, one TextBlock in it and wrote a few words at will. For such a simple application, if there are four displayed on a page, the crashed machine will still crash. At this time, we began to doubt that this problem really had nothing to do with the code we wrote and the managed part of the. NET Framework. Further experiments show that if you enter Chinese or use a Chinese font, it will crash. As long as the TextBlock is in English and no font is specified, or the specified font is in English, it will not crash.

 

Now the problem is more obvious: Chinese, or Chinese fonts are the culprit. At this point, we suddenly realized that no wonder the machines that will crash are all owned by artists and designers. These artists and designers install various fonts you have ever seen or never seen because of their work needs. At this time, we were surprised to find that:

1. We didn't use any special installed fonts in our Demo;

2. Even if we pack the fonts we need into XAP, we still don't need to use them;

3. Even if we display English, it will crash if we specify any Chinese font;

4. For users who have installed fonts, if the registry is changed (that is, they pretend that these fonts are not installed), the symptoms of crash will disappear.

 

At this time, we found that to solve this problem, we only seem to be able to tell the user to delete some problematic fonts or give them a script to disable some fonts. But which one is it, or which fonts will be faulty? My colleagues are in trouble again because the experiment shows that:

1. Some fonts won't go wrong. We call them group;

2. When other fonts exist at the same time, problems will occur. We will become Group B;

3. divide each three fonts in Group B into one group. If any group is disabled, the system will not crash;

4. Group B has a lot of fonts, and it takes a lot of time to experiment one by one. However, after a few clicks, it seems that disabling any one will not crash.

 

As everyone is discussing, what is the problem. Dangdang! I made a debut. I said: It doesn't seem like a malformed font that causes an unknown error, it is probably because of the Chinese font size and the English font size. Although it is strange, for example, the memory size is not close to 2 GB before the crash, it should not be the OOM problem, and the font I have never used or will not use in the future, why is it all loaded in? But it is not impossible. After all, Chinese fonts and English fonts are indeed different. In this way, we have made two experiments:

 

Experiment 1: delete one font in Group B on the machine that will crash, so that the four applications will not crash, and then load 5th applications. The result was not surprising.

Experiment 2: Load N applications on machines that we previously thought would not crash. We found that the load also crashed when about 30 applications were loaded. Note that it is not an OOM exception reported by. NET. We cannot solve this problem by writing code on our own.

At present, our progress is only here. Further troubleshooting and troubleshooting may be very difficult, because it is far beyond the hosting world. This problem should be solved by Microsoft, because strictly speaking, this is a Bug. But at least, the answer to QUIZ is:

 

If a page contains Chinese characters or any Chinese font is specified, one page contains about 1 to 30 SilverLight applications, which may cause an inexplicable crash. It depends on your career. For example, if you are a boring programmer, the number may be 30 or even greater. But if you are a talented artist, the number may be 1 if you are a programmer or artist, the most common number is 3 to 5. Oh, by the way, it may also be related to the SilverLight version. For example, if the number of SL4 is 4, the number of SL5 may be 5.

 

Well, there is another QUIZ, and the answer is coming soon.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.