I've been struggling with a number of hangs, dynamic timeouts, and outright crashes when using the search/documentation center in version 9. I've tried uninstalling/reinstalling and clearing preferences/cache on start-up, praying for a paclet update---but nothing seems to help.
One easily reproducible crash involves searching via the F1 key. On my machine (Windows 7, 64-bit), following the steps below, fails 100% of the time. (This is the simplest example I've taken the time to document; there seem to be many others.)
- With a fresh session (not always reproducible with just a fresh kernel), type something in the front-end. This could be text (in a text cell) or input (in an input cell) such as:
something
(and leave it unevaluated---if in an input cell) - Now highlight that input and hit "F1" to perform a search. This will either return a dynamic timeout warning, or momentarily freeze the front-end and do nothing.
- Now use your cursor to select
something
again and try "F1" a second time. This will perform the search as desired.
Can anyone reproduce this issue?
UPDATE 1:
Upgrading to 9.0.1 only partially addresses the issue. To illustrate, start a fresh session/kernel, type something
and then hit F1 (without manually highlighting something
). A similar hangup will occur.
As Albert points out in his answer, this hangup does not seem to occur with F1 searches on built-in symbols, highlighted or not.
Finally, FWIW, I suspect Albert's observation relates to another way I've encountered errors. Quite often when I come across some unfamiliar mathematical terminology on stackexchange, I reflexively copy and paste the term---from my browser, to the search field of the documentation center (which is almost always open when I'm working). Frequently this will generate the same type of error or worse. I suspect it has to do with whether or not the search term is either a built-in symbol or already indexed somehow.
UPDATE 2:
I recently decided to wipe my machine and reinstall everything from the OS up. Eventually I got around to installing Mathematica (from the exact same installer used previously). Much to my surprise, even without applying either of the two fixes, the hangups seem to be gone (or at least below what I can perceive). Just wanted to document this. Will report back if anything changes.
Answer
While trying to debug this issue myself, I stumbled across Todd Gayley's name in the source of one of the documentation .m files and contacted him directly. Todd was super great to work with---and at the end of an hour of screensharing he provided an easy workaround.
The workaround essentially short-circuits one tiny feature of a normal documentation search. Specifically, this fix prevents the documentation code from looking up the number of times the search term appears on WRI's website. As such, you will also no longer see a count of these search hits showing up in the 'Search Results' window in your Mathematica session.
Instructions:
(* execute this to locate your user init.m file*)
SystemOpen[FileNameJoin[{$UserBaseDirectory,"Kernel"}]]
(* open the file init.m file, append the following two lines, save and close it *)
Needs["DocumentationSearch`"];
Clear[DocumentationSearch`Private`urlImport];
Now close Mathematica and restart it. No more documentation search stutters.
Comments from WRI:
This bug is caused by a delay that can occur when Mathematica's internet connectivity code looks up a proxy. The delay generally occurs only once per session, which explains why users will generally find that subsequent documentation searches proceed quickly. The delay can be longer than the default Dynamic timeout, and thus you either get a quiet failure or see the Dynamic timeout warning dialog displayed.
If you can get by with not using a proxy at all, as suggested by @Robinaut, then that is ideal. If you do need to use a proxy, then this answer is the best way to handle the problem. Turning off all internet access in Mathematica is a sledgehammer fix that should be avoided.
We are working on a fix that will eliminate the delay, but if this is not forthcoming we will simply take out the call to urlImport. Therefore, no future versions of Mathematica will suffer from this problem. Thanks to @telefunkenvf14 for helping us discover the precise cause of this problem.
Comments
Post a Comment