Bug 109149 - HKCU\Software\Microsoft\Windows NT\CurrentVersion\windows will be accessed every time when pressing "Enter"
Summary: HKCU\Software\Microsoft\Windows NT\CurrentVersion\windows will be accessed ev...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium trivial
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0
Keywords:
Depends on:
Blocks: Too-Much-File-Access
  Show dependency treegraph
 
Reported: 2017-07-16 19:50 UTC by Telesto
Modified: 2023-05-31 13:11 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with debug symbols (5.05 KB, text/plain)
2023-05-28 17:36 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2017-07-16 19:50:25 UTC
Description:
HKCU\Software\Microsoft\Windows NT\CurrentVersion\windows will be accessed every time when pressing "Enter"

Steps to Reproduce:
1. Open Writer
2. Open Process Monitor with filter set to
* process name: soffice.bin and
* Operation: OpenRegKey 
3. Enable capture
4. Focus on Writer and press Enter a few times. Notice that HKCU\Software\Microsoft\Windows NT\CurrentVersion\windows will acessed every time when pressing enter [One or more printers should probably be installed]

If it isn't working:
4. Switch focus between Writer and Proces Monitor by clicking on the Process Monitor window and back into the Writer document

Actual Results:  
HKCU\Software\Microsoft\Windows NT\CurrentVersion\windows will acessed every time when pressing enter

Expected Results:
Shouldn't happen


Reproducible: Always

User Profile Reset: YES

Additional Info:
Found in
Versie: 5.4.0.2 
Build ID: 2b906d450a44f2bbe506dcd22c51b3fa11dc65fd
CPU-threads: 4; Besturingssysteem:Windows 6.2; UI-render: standaard; 
Locale: nl-NL (nl_NL); Calc: group

and in
Versie: 4.4.6.3 
Build ID: e8938fd3328e95dcf59dd64e7facd2c7d67c704d
Locale: nl_NL


21	WINSPOOL.DRV	DeviceCapabilitiesW + 0x39f
22	WINSPOOL.DRV	GetDefaultPrinterW + 0x99
23	WINSPOOL.DRV	GetDefaultPrinterW + 0x1e
24	mergedlo.dll	TabitemValue::isRightAligned + 0xe43
25	mergedlo.dll	Printer::GetDefaultPrinterName + 0xcc
26	mergedlo.dll	SfxViewShell::GetState_Impl + 0xfa
27	mergedlo.dll	SfxViewShell::SetZoomFactor + 0xae
28	mergedlo.dll	SfxShell::GetSlotState + 0xdb
29	swlo.dll	SwView::GetState + 0x1ae
30	swlo.dll	SwView::SetMailMergeConfigItem + 0x1be
31	mergedlo.dll	SfxDispatcher::FillState_ + 0x43
32	mergedlo.dll	SfxBindings::Update_Impl + 0xf1
33	mergedlo.dll	SfxBindings::NextJob_Impl + 0x15c
34	mergedlo.dll	SfxBindings::LinkStubNextJob + 0xe
35	mergedlo.dll	Timer::Invoke + 0xd
36	mergedlo.dll	WinBlocklistParser::parse + 0x8802
37	mergedlo.dll	WinBlocklistParser::parse + 0x67e0
38	USER32.dll	gapfnScSendMessage + 0x4e0
39	USER32.dll	gapfnScSendMessage + 0x5d3
40	USER32.dll	GetKeyboardLayout + 0x93c
41	USER32.dll	DispatchMessageW + 0x10
42	mergedlo.dll	WinBlocklistParser::parse + 0x6179
43	mergedlo.dll	WinBlocklistParser::parse + 0x629b
44	mergedlo.dll	WinBlocklistParser::parse + 0x608a
45	mergedlo.dll	Application::Execute + 0x177
46	mergedlo.dll	sfx2::SvBaseLink::setStreamToLoadFrom + 0x53e6
47	mergedlo.dll	DeInitVCL + 0xb5a
48	mergedlo.dll	SVMain + 0x29
49	mergedlo.dll	soffice_main + 0x10e
50	soffice.bin	soffice.bin + 0x1021
51	KERNEL32.DLL	BaseThreadInitThunk + 0xe
52	ntdll.dll	RtlInitializeExceptionChain + 0x85
53	ntdll.dll	RtlInitializeExceptionChain + 0x58


User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Buovjaga 2017-08-15 09:06:12 UTC
I am unable to repro. I did the window focus switching as well. I have printers.
Was previously unable to repro on a Win 10 VM which did not have printers.

Win 7 Pro 64-bit, Version: 5.4.0.3 (x64)
Build ID: 7556cbc6811c9d992f4064ab9287069087d7f62c
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: fi-FI (fi_FI); Calc: CL

Version: 6.0.0.0.alpha0+ (x64)
Build ID: bec5a2ac82b5178f6e765494c2003febe8ab51da
CPU threads: 4; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2017-08-12_23:35:00
Locale: fi-FI (fi_FI); Calc: CL
Comment 2 Xisco Faulí 2017-11-14 11:12:57 UTC
Hi Telesto,
Is this issue, still reproducible in master?
Comment 3 Telesto 2017-11-14 17:17:47 UTC
Still reproducible for me
Version: 6.0.0.0.alpha1+
Build ID: d73225119476de1826f648acca9e93bf6797e813
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 4 Xisco Faulí 2018-11-27 12:58:33 UTC
Hi Telesto,
Is this issue, still reproducible in master?
Comment 5 Telesto 2018-11-27 15:44:48 UTC
Still the same
Version: 6.3.0.0.alpha0+
Build ID: d71ea82055a6a304493c7eaa90809a348e23784d
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-11-19_03:25:07
Locale: en-US (nl_NL); UI-Language: en-US
Calc: CL
Comment 6 Xisco Faulí 2019-05-30 11:17:21 UTC
Hi Telesto,
Any chance this could be bisected ?
Comment 7 Xisco Faulí 2019-07-05 10:17:46 UTC
(In reply to Xisco Faulí from comment #6)
> Hi Telesto,
> Any chance this could be bisected ?

ping ?
Comment 8 Telesto 2019-07-05 11:41:22 UTC
Repro with
Version: 6.4.0.0.alpha0+ (x86)
Build ID: c2cb467a1e5194c56bb65706b7965fb2c9241b8f
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-06-29_00:11:35
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: threaded

and with
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 9 Sweet-Brain 2019-08-07 08:13:39 UTC Comment hidden (spam)
Comment 10 menhealthadvisor 2019-08-07 08:50:35 UTC Comment hidden (spam)
Comment 11 Aron Budea 2019-08-10 14:36:42 UTC
I can confirm with LO 6.3.0.3 / Windows 7.

(In reply to Telesto from comment #0)
> 2. Open Process Monitor with filter set to
> * process name: soffice.bin and
> * Operation: OpenRegKey 
The correct operation is RegOpenKey.
Comment 12 foodandfoodtrips 2019-09-25 13:03:15 UTC Comment hidden (spam)
Comment 13 QA Administrators 2021-09-25 03:39:11 UTC Comment hidden (obsolete)
Comment 14 Julien Nabet 2023-05-28 17:36:10 UTC
Created attachment 187561 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I don't know if it's related but since you quoted "GetDefaultPrinterName", I gave a try and I confirm that each type, I type a key, it goes into this method.

But it doesn't call only this one (slot SID_PRINTDOCDIRECT), it a but also:
- SID_SETUPPRINTER
- SID_PRINTDOC
Comment 15 Julien Nabet 2023-05-28 17:45:03 UTC
Caolán: is there no other way to be sure that LO session is synchronized with OS config (because each OS is concerned I suppose) about printer?
Comment 16 Caolán McNamara 2023-05-28 20:26:57 UTC
Every time we type we call SfxBindings::InvalidateAll which causes all bindings to query their current state. And that SID_PRINTDOCDIRECT one gets the printername so it can put (PrinterName) into its description.

Is there a specific reason this is seen as a problem though?
Comment 17 Julien Nabet 2023-05-28 21:26:29 UTC
(In reply to Caolán McNamara from comment #16)
> Every time we type we call SfxBindings::InvalidateAll which causes all
> bindings to query their current state. And that SID_PRINTDOCDIRECT one gets
> the printername so it can put (PrinterName) into its description.
> 
> Is there a specific reason this is seen as a problem though?

Thank you for the quick feedback!
Just wonder if it would have some impact on perf. I can understand the spell checking at each key typing but for printer config, thought it would be called once per session (of course it would mean to be forced to restart LO when printing conf changes).
I recognize I got no figures to indicate there’s indeed a perf pb or not, so I’ll try to find a way to chase the initial issue, ie the Windows registry entry call which doesn’t seem very useful.
Comment 18 Caolán McNamara 2023-05-31 08:28:54 UTC
It does seem a little excessive to check so often, when we just end up using this as a label/tooltip. We could e.g. cache the label and only update it if it is more than 5 minutes old or something like that.
Comment 19 Commit Notification 2023-05-31 13:11:18 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f1ec565d4843284e43614d208b006420732b98e8

Resolves: tdf#109149 don't poll the Default Printer Name on every query

It will be available in 7.6.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.