Skip to content

cpu usage high with windows change dir / winDialogString (PR#11045)

10 messages · Gabor Grothendieck, Duncan Murdoch, Sean O'Riordain

#
Good afternoon,

This is possibly a windows only bug, definitely of comparatively low
importance - but for the sake of completeness here we go.  I've
searched http://bugs.R-project.org/ etc., but can find no mention.

For RGui.exe, the CPU usage goes to 100% for certain dialog boxes for
the duration that the dialog box is visible, e.g.

* check CPU usage is low
* On the RGui.exe menu chose File / Change dir...
* the CPU usage goes to 100%
* hit OK
* the CPU usage goes back down again

This also occurs when I incant Help / Apropos or Help / Search help...
or at the "command prompt"
Note the latter also applies to R.exe inside a cmd window.

I've checked this with a few windows machines for 2.6.2 & 2.6.1 -
including with --vanilla.  This machine here has the following...
R version 2.6.2 (2008-02-08)
i386-pc-mingw32

locale:
LC_COLLATE=English_Ireland.1252;LC_CTYPE=English_Ireland.1252;LC_MONETARY=English_Ireland.1252;LC_NUMERIC=C;LC_TIME=English_Ireland.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
_
platform       i386-pc-mingw32
arch           i386
os             mingw32
system         i386, mingw32
status
major          2
minor          6.2
year           2008
month          02
day            08
svn rev        44383
language       R
version.string R version 2.6.2 (2008-02-08)

I am not familiar with the R sources, so the following should be taken
with a large grain of salt... to my uninitiated eyes it appears to be
something to do with askstring() in src\extra\graphapp\dialogs.c
or possibly handle_message_dialog() - I'm afraid I have never
programmed windows at a low level so I'm not sure what's going on
here...

I am of course available to help pin this down - but unfortunately I
don't have a development environment here.

Best Regards,
Sean O'Riordain
Dublin, Ireland
not affiliated...
seanpor A T acm D ot org
1 day later
#
On 28/03/2008 12:05 PM, seanpor at acm.org wrote:
What is the bug here?  I'd guess it's not R using the cpu, rather some 
other process hooked to the dialog, but even if it really is R, why is 
this a bug?

Duncan Murdoch
#
On Sat, Mar 29, 2008 at 12:06 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
Maybe R is sitting in a loop consuming all the resources of the system?
#
On 29/03/2008 12:23 PM, Gabor Grothendieck wrote:
It's a SHBrowseForFolder call, with a callback.  If there's a bug, it 
looks to me as though it's in Windows.

Duncan Murdoch
#
On Sat, Mar 29, 2008 at 12:32 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
I wonder if any of the numerous settings in the _browseinfo
structure might be impacting this such as looking for networking
folders and if the user's networking setup impacts this since it
could start performing some network functions to find files over
a network.
#
Good afternoon Duncan,

Thanks for that.  See below for my reply.

Best Regards,
Sean
On 29/03/2008, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
Using Taskmanager it shows that RGui.exe is using 92-95% CPU while the
winDialogString() is open and 0% when the dialog is closed or a
different R dialog is used e.g. winDialog("yesnocancel", "Do you
agree?").  The bug is that the cpu usage is unusually high - by
comparison for other dialogs e.g. File / Open script... the cpu usage
stays low - for other windows applications it is not "normal" for cpu
usage to be at 100% while waiting for user input - on slower machines
(e.g. my ancient laptop) this can bring the machine to its' knees
(almost) for the short duration that the dialog is open!  If I select
the "Browse" button, the cpu usage for RGui.exe falls away to 0% so it
is only during the period that R is waiting for the user to fill in
the dialog.  Not an important bug by any means!

Best regards,
Sean
#
Hi Duncan,

I suspect that it's not the SHBrowseForFolder call as it seems fine
once the Browse button is pressed - the problem occurs *before* the
Browse button is pressed.

Regards,
Sean
On 29/03/2008, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
#
On 29/03/2008 1:10 PM, Sean O'Riordain wrote:
The Change Dir dialog in R 2.7.0 no longer uses the 
winDialogString()-like dialog, so the problem will go away in that one 
case, but any other user of the underlying code will still have the 
problem.  It's because that function sets up a loop to poll for results. 
  Doesn't really seem worth the trouble to fix.

Duncan Murdoch
#
On 29/03/2008 1:21 PM, Duncan Murdoch wrote:
... but it turned out to be not much trouble at all.  So, this will be 
fixed in 2.7.0.  Thanks for pointing this out.

Duncan Murdoch
#
I did a few other places where askstring() is used, e.g. Help /
apropos... and friends.

No problem Duncan if you decide not to fix.  It's one of those "it'd
be nice if it was fixed - but it's not a problem if it doesn't"
bugs... :-)  and now that I have a modern (i.e. 5 year old Linux
machine) at home I'm no longer reliant on the ancient laptop for
everyday use!

All the best,
Sean
On 29/03/2008, Duncan Murdoch <murdoch at stats.uwo.ca> wrote: