# Documentation searches hang frequently: Anyone else dealing with this?

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.)

1. 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)
2. 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.
3. 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.

-
same problem here (also on win7 64bit). I'm just downloading version 9.0.1 which mentions some fixes and will report whether that has been solved... –  Albert Retey Feb 3 '13 at 16:45
FYI, I cannot reproduce this behavior on MMA v9.0.1 under Mac OS X. –  David Skulsky Feb 3 '13 at 16:46
No problem with 9.0.1 on Windows 7 64bit. Just do not use 9.0.0 anymore. –  Rolf Mertig Feb 3 '13 at 17:12
I have seen the same problem with version 9.0.0 on Windows 7 64bit. I just downloaded version 9.0.1 and unfortunately the problem is still there. It probably is worth mentioning that the problem does only exist if the highlighted word is not a known Mathematica symbol. –  Albert Retey Feb 3 '13 at 19:04
Good observation on the known MMA symbols. I updated my question with some info you might be interested in. –  telefunkenvf14 Feb 3 '13 at 20:00

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[DocumentationSearchPrivateurlImport];
`

Now close Mathematica and restart it. No more documentation search stutters.

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.

-
Thanks for posting this. When we talked I promised I would do it myself, but it slipped my mind. I've edited your answer to include some more comments. –  Todd Gayley Mar 12 '13 at 12:56

This is from Wolfram technical support:

De-select Help > Internet Connectivity > "Allow Mathematica to access the Internet" and then try using the Documentation Center. If this fixes the hang then have them allow internet connectivity again and test the Documentation Center again.

Finally, setting my proxy settings to "Direct connection to the internet" fixed the problem!

-
That is a great answer. It helped immediatly! –  Lou Feb 14 '13 at 21:43
@telefunkenvf14 Did that also worked for you? –  Robinaut Mar 6 '13 at 5:50
I actually spent about an hour on the phone with @Todd Gayley and we traced the source of the hangup to a particular feature that involves the way MMA interacts with the internet during search queries. I'll post the workaround Todd gave me and will ask him to comment on which approach is best. BTW, did tech support suggest the 'direct connection to the internet' setting? –  telefunkenvf14 Mar 12 '13 at 5:16
They suggested to check the proxy setting. Maybe it is the automatic proxy detection which does not work. –  Robinaut Mar 12 '13 at 6:34
@Robinaut Posted answer of another workaround. Hopefully Todd will be dropping by to offer his thoughts. –  telefunkenvf14 Mar 12 '13 at 9:45