Explorer Preview handler may hang Lister. Is there a way to avoid it?
Posted: 2021-04-29, 20:31 UTC
This is not a typical bugreport, even if it looks alike, but my thoughts and question.
After a lot of different tests of Lister in TC 10 beta I saw the cases when Explorer Preview may hang, making Lister and TC non-responsive. Here it a simplified test example and explanation.
testdoc.htm
This is a very simple web page created according to XHTML 1.1 standard (XHTML is used quite rarely nowadays in favour of HTML5). The distinctive feature of XHTML is the first line describing it as XML document according to a general idea that XHTML is a particular case of XML with specific document type definition (DTD). DTD is defined by link to w3.org website. In a web browser or in Lister with default settings this file is shown without any problem; Lister detects it as HTML and removes all tags, showing only a single paragraph, as supposed.
The difficulty begins when we try to open this file in MS Word, in my case it's Word 2013. Rename the file to testdoc.doc and double-click it. Word refuses to open it, showing the warning instead; you can expand and see the explanation. The reason behind this is security measures, which block any external (web) links in XML file because they may be potentially dangerous. So, you cannot open this document in MS Word for view or edit, this blocking is intentionally designed by Word developers. But this is not a great problem yet.
Now try to open the renamed file testdoc.doc in Lister. It still shows it as HTML document with UTF-8 encoding, thanks to format autodetection. Now try to switch Lister to Explorer Preview mode (8). Lister hangs and TC becomes non-responsive. You can launch the Task Manager and see the Microsoft Word in the Apps list; it doesn't show a window and cannot be interacted. The only option is to end this task in Task Manager menu. After that Lister will show the file content as binary (2), counting this as a handler failure, and TC becomes responsive again.
This is obviously not a TC bug, it's a design flaw of MS Word as external preview program, when it doesn't show a warning which is visible in normal mode and doesn't have any window to interact with, it simply hangs and is hanging the call chain: Lister and TC. As a result, it's not possible to restore TC using its own controls.
I think that at some point of TC development it would have sense to foresee such situations and find some solution. Maybe it's possible to call an external handler as a separate process, which in the case of failure will not hang or crash Lister and TC. Then, if external handler does not respond for reasonable time, terminate it. Or maybe there are some other solutions available right now, like creating an intermediate layer or simply using a different preview mode. If someone can suggest a solution, please add it here.
NB: I didn't have any intention to hang your TC using the test above, but it's an inevitable side effect; it should not crash a whole OS. Please don't use TC for other actions during the test. Anyway, please accept my apologies.
After a lot of different tests of Lister in TC 10 beta I saw the cases when Explorer Preview may hang, making Lister and TC non-responsive. Here it a simplified test example and explanation.
testdoc.htm
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<body>
<p>Test page</p>
</body>
</html>
The difficulty begins when we try to open this file in MS Word, in my case it's Word 2013. Rename the file to testdoc.doc and double-click it. Word refuses to open it, showing the warning instead; you can expand and see the explanation. The reason behind this is security measures, which block any external (web) links in XML file because they may be potentially dangerous. So, you cannot open this document in MS Word for view or edit, this blocking is intentionally designed by Word developers. But this is not a great problem yet.
Now try to open the renamed file testdoc.doc in Lister. It still shows it as HTML document with UTF-8 encoding, thanks to format autodetection. Now try to switch Lister to Explorer Preview mode (8). Lister hangs and TC becomes non-responsive. You can launch the Task Manager and see the Microsoft Word in the Apps list; it doesn't show a window and cannot be interacted. The only option is to end this task in Task Manager menu. After that Lister will show the file content as binary (2), counting this as a handler failure, and TC becomes responsive again.
This is obviously not a TC bug, it's a design flaw of MS Word as external preview program, when it doesn't show a warning which is visible in normal mode and doesn't have any window to interact with, it simply hangs and is hanging the call chain: Lister and TC. As a result, it's not possible to restore TC using its own controls.
I think that at some point of TC development it would have sense to foresee such situations and find some solution. Maybe it's possible to call an external handler as a separate process, which in the case of failure will not hang or crash Lister and TC. Then, if external handler does not respond for reasonable time, terminate it. Or maybe there are some other solutions available right now, like creating an intermediate layer or simply using a different preview mode. If someone can suggest a solution, please add it here.
NB: I didn't have any intention to hang your TC using the test above, but it's an inevitable side effect; it should not crash a whole OS. Please don't use TC for other actions during the test. Anyway, please accept my apologies.