Tuesday, September 4, 2012

While Multicore Gently Weeps

Started file search for "*TRANS*" in Eclipse. Twice. Unintentional wildcard pattern, I wanted to find "*TRANS*" literally. Each gets stuck in one file, like forever. 100%CPU each. Canceled both; or tried to. The other is still "File Search (Cancel Requested)".

It's a shame that it's not widely recognized that half of the benefit of threads is to always be able to cleanly cancel them. It helps realize the benefit of thread as background workers.

By cleanly, I mean that locks and resources held should be released, too.

Of course, in the case of file search, subprocessing could probably be used almost as well; just that internal caches and file editing state might not easily be made available to a subprocess.


Now at least one of them is gone. But the other persists, searching that file in vain. (There must also be something wrong with the (regex?) pattern match engine or something. I've happened upon regex patterns that would Pattern.compile into exponentially (or even worse?) time-consuming matchers. Unkillable, too.)


Ok, now (perhaps 10 minutes later) the other one died. 

No comments:

Post a Comment