From unknown Sun Sep 21 08:31:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#74311 <74311@debbugs.gnu.org> To: bug#74311 <74311@debbugs.gnu.org> Subject: Status: Long startup time on windows (with simple fix) Reply-To: bug#74311 <74311@debbugs.gnu.org> Date: Sun, 21 Sep 2025 15:31:43 +0000 retitle 74311 Long startup time on windows (with simple fix) reassign 74311 emacs submitter 74311 Vladimir =C5=A0ironja severity 74311 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 11 07:50:32 2024 Received: (at submit) by debbugs.gnu.org; 11 Nov 2024 12:50:32 +0000 Received: from localhost ([127.0.0.1]:58606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tATsF-0006qi-UV for submit@debbugs.gnu.org; Mon, 11 Nov 2024 07:50:32 -0500 Received: from lists.gnu.org ([209.51.188.17]:41018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tASfe-0003Jn-EP for submit@debbugs.gnu.org; Mon, 11 Nov 2024 06:33:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tASdR-0000sX-JM for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 06:31:11 -0500 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tASdP-0003r4-Rl for bug-gnu-emacs@gnu.org; Mon, 11 Nov 2024 06:31:09 -0500 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-6ea7c9227bfso43708417b3.2 for ; Mon, 11 Nov 2024 03:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731324665; x=1731929465; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GlLLlVv3BeNJixMzasCZx/A7S1TGFtNl/Fc/1iSvC78=; b=TK5+yWgXHR7Kwz8mjKGJbQvhNbrqzVllBPWWSEAA20zP5VEIsco4Zydb90l4F6nHGJ H4tr9fOOBibMwXVrAs5gq4DziPMRTQ/SSuEk8hNWT2MxLJn1BfT62y2KR5riy6It9Qcx OAxjhsNOAF2llMMLY+QrjPLYPTI0IhPGnBt5gW9+Y0ikfuFDutOIQDPqq0aHBD9znMAg s5FubS3WDFO1U+ztUKCTNTD+BqeqJKvc71CaD+Vy+YYaYWFw9OY8mHsgQK5y7N+sXJiv XidZ03Up72G8e2krdXpZeWrSajkFskFFfXTxzcbwebv3SvqxmURmQ3rNXr13/Yc/8l+C 8ajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731324665; x=1731929465; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GlLLlVv3BeNJixMzasCZx/A7S1TGFtNl/Fc/1iSvC78=; b=sr0UieLhvLpuvkZhJycBSdFNntaNy1cvtsYmW4T4f0KLJF7Ox2+gyKyMb9Adt5f4xq Qbety/byJHvdQJgak1I7zo1aXgfOFWi/+X9UAvAD05Ie/Cm0QeEG2hhcCO9SJKrU0rlJ RR4jocEMCpKa+XUGlPR99wUXmIEN1eVAB4hYaR0Nr5x15AokA51gpcpPG+3E9Vt9uu7s I0Nr90+/5WOGDPpMGWASwRivvlrCo4PWeRH96S2GKB6cIpmhVsNClFUTT9FFpLEUSKqa t+E7n4ve/7485bI8SeBHr5M7G32rZk3pbPXqUXWobza7Gj92z9NEzVZLB0kWTT4qtnb8 Mc9g== X-Gm-Message-State: AOJu0YwYbxHy+VsrO5SGiVyMZKPoRV5VksHw4EFrv03jFo2hvoogRbIt sRJYcmPSFkPWZL7Gds6m7yx/a+m1Y0XdzAQ13Y0KedC/MigkWOvAlKw7Dwa0FUxQgTnrlXVbFWf 1NPUjgEDImMEyCWxJsHAsQyxBZ9S+rA2EJ7U= X-Google-Smtp-Source: AGHT+IEFr4SzHw5YfO3BhudPjcab4KQ2e2HWpC1pqEJoZBmOLz0bDojnkXV+SwdW8iyH0PsWWOhBGn+/3HlgQiMGpUo= X-Received: by 2002:a05:690c:64c8:b0:6e3:29ae:a3a5 with SMTP id 00721157ae682-6eaddf97896mr113318037b3.34.1731324665027; Mon, 11 Nov 2024 03:31:05 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?Q?Vladimir_=C5=A0ironja?= Date: Mon, 11 Nov 2024 12:30:54 +0100 Message-ID: Subject: Long startup time on windows (with simple fix) To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::1130; envelope-from=vladimir.sironja@gmail.com; helo=mail-yw1-x1130.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 11 Nov 2024 07:50:30 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hello, I have (*had!) a very annoying occurrence of long startup times on windows 10 & 11. Ended up with emacs 29.4 but tried several 28 and 26 versions with no difference. It takes sometimes around 30 secs for emacs to come up. But not always, let's say a third of strarts were normal within a second. Tried excluding relevant directories from virus check; no difference. Also tried starting without init files (-Q); no difference. So compiled with debug symbols gcc version 14.2.0 on msys2. (Had to set manually add "#define HAVE_SYS_WAIT_H 1" into src/config.h - but that's another issue, already handled several times in this group.) In gdb-debugger caught the hanging operation: Thread 1 (Thread 19568.0x24c0): #0 0x00007ff9e2331244 in ntdll!ZwAlpcSendWaitReceivePort () from C:\WINDOWS\SYSTEM32\ntdll.dll #1 0x00007ff9e0a4b032 in RpcBindingFromStringBindingW () from C:\WINDOWS\System32\rpcrt4.dll #2 0x00007ff9e0a47efb in RpcBindingFromStringBindingW () from C:\WINDOWS\System32\rpcrt4.dll #3 0x00007ff9e0a66c19 in RPCRT4!I_RpcSendReceive () from C:\WINDOWS\System32\rpcrt4.dll #4 0x00007ff9e0a66b5f in RPCRT4!NdrSendReceive () from C:\WINDOWS\System32\rpcrt4.dll #5 0x00007ff9e0af07da in RPCRT4!NdrClientCall3 () from C:\WINDOWS\System32\rpcrt4.dll #6 0x00007ff9e0aef69b in RPCRT4!NdrClientCall3 () from C:\WINDOWS\System32\rpcrt4.dll #7 0x00007ff9e11c6046 in SECHOST!LookupAccountSidLocalW () from C:\WINDOWS\System32\sechost.dll #8 0x00007ff9e11c5d4f in SECHOST!LookupAccountSidLocalW () from C:\WINDOWS\System32\sechost.dll #9 0x00007ff9e11dead3 in SECHOST!LookupAccountSidLocalA () from C:\WINDOWS\System32\sechost.dll #10 0x00007ff9e0d9bce0 in LookupAccountSidA () from C:\WINDOWS\System32\advapi32.dll #11 0x00007ff63569a990 in lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x4b414a8, Name=3D0xbfe740 "\030D=E2=95=A65\001", cbName=3D0xbfe320, DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:706 #12 0x00007ff63569d35f in init_user_info () at w32.c:2319 #13 0x00007ff63569f151 in init_environment (argv=3D0xd315b0) at w32.c:3198 #14 0x00007ff6354b93de in main (argc=3D1, argv=3D0xd315b0) at emacs.c:2120 Ok, so noticed that it if s_pfn_Lookup_Account_Sid (LookupAccountSid) invoked for the *second* time, it blocks for around half a minute causing the delay. However, when lucky, the function is invoked only once and it just works as always. I didn't analyse the cause for multiple invocations, but added a simple naive workaround to test the theory - which simply caches the results of LookupAccountSid. from w32.c: struct lookup_account_sid_cache { BOOL ret; LPTSTR Name; LPSTR DomainName; SID_NAME_USE peUse; }; static BOOL WINAPI lookup_account_sid (LPCTSTR lpSystemName, PSID Sid, LPTSTR Name, LPDWORD cbName, LPTSTR DomainName, LPDWORD cbDomainName, PSID_NAME_USE peUse) { static struct lookup_account_sid_cache cache =3D { 0, NULL, NULL, 0 }; static LookupAccountSid_Proc s_pfn_Lookup_Account_Sid =3D NULL; HMODULE hm_advapi32 =3D NULL; if (is_windows_9x () =3D=3D TRUE) { return FALSE; } if (g_b_init_lookup_account_sid =3D=3D 0) { g_b_init_lookup_account_sid =3D 1; hm_advapi32 =3D LoadLibrary ("Advapi32.dll"); s_pfn_Lookup_Account_Sid =3D (LookupAccountSid_Proc) get_proc_addr (hm_advapi32, LookupAccountSid_Name); } if (s_pfn_Lookup_Account_Sid =3D=3D NULL) { return FALSE; } BOOL ret; if(!cache.ret) { ret =3D s_pfn_Lookup_Account_Sid ( lpSystemName, Sid, Name, cbName, DomainName, cbDomainName, peUse); if(ret) { cache.ret =3D ret; cache.Name =3D Name && *Name ? strdup(Name) : NULL; cache.DomainName =3D DomainName && *DomainName ? strdup(DomainName) := NULL; cache.peUse =3D peUse ? *peUse : 0; } } else { ret =3D cache.ret; if(cache.Name) { strncpy(Name, cache.Name, *cbName); *cbName =3D strlen(cache.Name); } if(cache.DomainName && cbDomainName && *cbDomainName > 0) { if(DomainName) strncpy(DomainName, cache.DomainName, *cbDomainName); *cbDomainName =3D strlen(cache.DomainName); } if(peUse) *peUse =3D cache.peUse; } return ret; } Tried about 30 times since the fix: works like a charm. Please change the code - to invoke the offending winapi function only once, since it obviously punishes the second caller. Or perhaps a caching mechanism as above. Cheers to fellow emacsers! And thx for all the good work form the team Bye Vlado From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 11 08:14:12 2024 Received: (at 74311) by debbugs.gnu.org; 11 Nov 2024 13:14:13 +0000 Received: from localhost ([127.0.0.1]:58631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAUFA-0007oB-Fk for submit@debbugs.gnu.org; Mon, 11 Nov 2024 08:14:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAUF8-0007nz-Pz for 74311@debbugs.gnu.org; Mon, 11 Nov 2024 08:14:11 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAUEz-0007vI-Ag; Mon, 11 Nov 2024 08:14:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Or72rTmo1bd4JanwExDzvJ/cQ6rd+aPK+Ll8VisFcu4=; b=c7N4xq0kuBJu+ijZR5NR e1M668313YVGkJarAQUpc1eRTQJ7Zbls+DqQLbLgkSH2PfnaDmUHD2jDFK26bHo/qg6oEqqE7tDaO LI+Mt43G7DDvsV0JUlZTPHWc8DBWHgtiYj3frvi3/0MaijYYalI/rISC7eTVJ/HEQBZc8SdxyY8d5 eKySeikUnaPLLS2laWtBZMT9fk3HHeeTdSwmQYQkLlma33TeMbzvw1zC3trshcLlGN0IUdH4jaT7V 90XEca98axQ0XF6dlP0meSonmwif+IPOpdY1ns2pFLdMOEt3typpToxb6gz0zDPT/Cg5937eUu3oG U88OUmfNW1Neew==; Date: Mon, 11 Nov 2024 15:13:51 +0200 Message-Id: <86v7wtkj5c.fsf@gnu.org> From: Eli Zaretskii To: Vladimir =?utf-8?Q?=C5=A0ironja?= In-Reply-To: (message from Vladimir =?utf-8?Q?=C5=A0ironja?= on Mon, 11 Nov 2024 12:30:54 +0100) Subject: Re: bug#74311: Long startup time on windows (with simple fix) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74311 Cc: 74311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vladimir Šironja > Date: Mon, 11 Nov 2024 12:30:54 +0100 > > Hello, > I have (*had!) a very annoying occurrence of long startup times on > windows 10 & 11. > Ended up with emacs 29.4 but tried several 28 and 26 versions with no > difference. > It takes sometimes around 30 secs for emacs to come up. > But not always, let's say a third of strarts were normal within a second. > Tried excluding relevant directories from virus check; no difference. > Also tried starting without init files (-Q); no difference. > So compiled with debug symbols gcc version 14.2.0 on msys2. > (Had to set manually add "#define HAVE_SYS_WAIT_H 1" into src/config.h > - but that's another issue, already handled several times in this > group.) > > In gdb-debugger caught the hanging operation: > > Thread 1 (Thread 19568.0x24c0): > #0 0x00007ff9e2331244 in ntdll!ZwAlpcSendWaitReceivePort () from > C:\WINDOWS\SYSTEM32\ntdll.dll > #1 0x00007ff9e0a4b032 in RpcBindingFromStringBindingW () from > C:\WINDOWS\System32\rpcrt4.dll > #2 0x00007ff9e0a47efb in RpcBindingFromStringBindingW () from > C:\WINDOWS\System32\rpcrt4.dll > #3 0x00007ff9e0a66c19 in RPCRT4!I_RpcSendReceive () from > C:\WINDOWS\System32\rpcrt4.dll > #4 0x00007ff9e0a66b5f in RPCRT4!NdrSendReceive () from > C:\WINDOWS\System32\rpcrt4.dll > #5 0x00007ff9e0af07da in RPCRT4!NdrClientCall3 () from > C:\WINDOWS\System32\rpcrt4.dll > #6 0x00007ff9e0aef69b in RPCRT4!NdrClientCall3 () from > C:\WINDOWS\System32\rpcrt4.dll > #7 0x00007ff9e11c6046 in SECHOST!LookupAccountSidLocalW () from > C:\WINDOWS\System32\sechost.dll > #8 0x00007ff9e11c5d4f in SECHOST!LookupAccountSidLocalW () from > C:\WINDOWS\System32\sechost.dll > #9 0x00007ff9e11dead3 in SECHOST!LookupAccountSidLocalA () from > C:\WINDOWS\System32\sechost.dll > #10 0x00007ff9e0d9bce0 in LookupAccountSidA () from > C:\WINDOWS\System32\advapi32.dll > #11 0x00007ff63569a990 in lookup_account_sid (lpSystemName=0x0, > Sid=0x4b414a8, Name=0xbfe740 "\030D╦5\001", cbName=0xbfe320, > DomainName=0x0, cbDomainName=0xbfe328, peUse=0xbfe314) at w32.c:706 > #12 0x00007ff63569d35f in init_user_info () at w32.c:2319 > #13 0x00007ff63569f151 in init_environment (argv=0xd315b0) at w32.c:3198 > #14 0x00007ff6354b93de in main (argc=1, argv=0xd315b0) at emacs.c:2120 So this is a completely different issue, and should have been submitted as a separate bug report. > Ok, so noticed that it if s_pfn_Lookup_Account_Sid (LookupAccountSid) > invoked for the *second* time, it blocks for around half a minute > causing the delay. The questions is: why does it happen on your system. It doesn't happen here on my Windows 11 system, and never happened on my previous and other Windows systems where I use Emacs with this code. Are you working on a system under a domain controller, where Net Logon service is enabled? We have a known problem described in etc/PROBLEMS, with a possible solution; search for "Net Logon". If that solution helps, then maybe your Domain Controller is set up sub-optimally, and need to be looked into. > I didn't analyse the cause for multiple invocations, but added a > simple naive workaround to test the theory - which simply caches the > results of LookupAccountSid. Caching the results of LookupAccountSid is problematic: the results might change behind Emacs's back, and we have no good way of knowing when that happens (to invalidate the cache). > Please change the code - to invoke the offending winapi function only > once, since it obviously punishes the second caller. Or perhaps a > caching mechanism as above. Can you show the backtraces for the two calls to LookupAccountSid? The two calls inside lookup_account_sid are not identical: the first gets information about the user, the second about its group. So if you are talking about using just one of these two, then the results will not be correct for the user's group. But if you see two calls to LookupAccountSid with the same arguments, then please show the backtraces from these duplicate calls. P.S. If you want to keep discussing this bug further, please submit a separate new bug report using "M-x report-emacs-bug". From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 11 09:46:45 2024 Received: (at 74311) by debbugs.gnu.org; 11 Nov 2024 14:46:45 +0000 Received: from localhost ([127.0.0.1]:58824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAVgi-0003fe-Ou for submit@debbugs.gnu.org; Mon, 11 Nov 2024 09:46:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAVgg-0003fM-C7 for 74311@debbugs.gnu.org; Mon, 11 Nov 2024 09:46:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAVga-0001c9-Tz; Mon, 11 Nov 2024 09:46:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=lLB/iFCu+TNt5MMTn/4GAzn/75UVXvzdoBOHBcu94mw=; b=HHG+PKegjfRcWi2vsSQP x+clC+JRMtsehzzs6kZTXyA5/dPji0Mwz6RSVHRefLod/Kox14QWeR3wmuXpBhbiNIa55OFO7nSKL 2RO5umpBp68lPWq2hr4DfRHheigIgO9ToBO0EyNs58kh1VjmftL+ECFsnS8/zIdLmqHv5jZH27P00 05uNUHqJ7WmcgyQZ/AO4whbA8dX7BeV07UPlIuI86Sq2OdclCUc0KPS2x3Sx2YXaq/if7OoNvjFov 7OaHmbkUhpZmoy3jt/EhB/QTswsO4Niw4ixfru+cGngUhbn+PmJfvjzQ+q1MWMR9DZrL54y6pirfp jx/ZJS2h8/yvpg==; Date: Mon, 11 Nov 2024 16:46:33 +0200 Message-Id: <86ttcdkeuu.fsf@gnu.org> From: Eli Zaretskii To: Vladimir =?utf-8?Q?=C5=A0ironja?= In-Reply-To: (message from Vladimir =?utf-8?Q?=C5=A0ironja?= on Mon, 11 Nov 2024 15:12:39 +0100) Subject: Re: bug#74311: Long startup time on windows (with simple fix) References: <86v7wtkj5c.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74311 Cc: 74311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Vladimir Šironja > Date: Mon, 11 Nov 2024 15:12:39 +0100 > Cc: 74311@debbugs.gnu.org > > sorry, didn't quite understand which bugs should be separated, please > advice again, Sorry, my misunderstanding, please ignore that part. > 1) regarding netlogon, I do not really have an option disconnecting from DC Canj you at least try it once, to see if that is the root cause? > Here the debugger session: > > (gdb) b w32.c:701 > Breakpoint 1 at 0x40031a8e0: file w32.c, line 701. > (gdb) run > Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe > [New Thread 20812.0x73b4] > [New Thread 20812.0x7bbc] > [New Thread 20812.0x60fc] > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > Sid=0x3e714b0, Name=0xbfe850 "└o\021", cbName=0xbfe32c, > DomainName=0xbfe330 "b", cbDomainName=0xbfe328, peUse=0xbfe314) at > w32.c:701 > 701 HMODULE hm_advapi32 = NULL; > (gdb) bt > #0 lookup_account_sid (lpSystemName=0x0, Sid=0x3e714b0, Name=0xbfe850 > "└o\021", cbName=0xbfe32c, DomainName=0xbfe330 "b", > cbDomainName=0xbfe328, peUse=0xbfe314) at w32.c:701 > #1 0x00007ff79378d364 in init_user_info () at w32.c:2314 > #2 0x00007ff79378f2fe in init_environment (argv=0x26015b0) at w32.c:3233 > #3 0x00007ff7935a93de in main (argc=1, argv=0x26015b0) at emacs.c:2120 > (gdb) continue > Continuing. > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > Sid=0x3e714a8, Name=0xbfe740 "XD┌ô\001", cbName=0xbfe320, > DomainName=0x0, cbDomainName=0xbfe328, peUse=0xbfe314) at w32.c:701 > 701 HMODULE hm_advapi32 = NULL; > (gdb) bt > #0 lookup_account_sid (lpSystemName=0x0, Sid=0x3e714a8, Name=0xbfe740 > "XD┌ô\001", cbName=0xbfe320, DomainName=0x0, cbDomainName=0xbfe328, > peUse=0xbfe314) at w32.c:701 > #1 0x00007ff79378d50c in init_user_info () at w32.c:2354 > #2 0x00007ff79378f2fe in init_environment (argv=0x26015b0) at w32.c:3233 > #3 0x00007ff7935a93de in main (argc=1, argv=0x26015b0) at emacs.c:2120 > (gdb) info locals > cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > 0x26065b0 "EDGE", peUse = SidTypeUser} > been_here_count = 2 > s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > hm_advapi32 = 0x7ff9e0d50000 > ret = 5 > (gdb) continue > Continuing. > [New Thread 20812.0x4594] > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > Sid=0x1242d4, Name=0xbfdb30 "\220\\q̨\177", cbName=0xbfdb2c, > DomainName=0xbfd720 "P3\022", cbDomainName=0xbfd71c, peUse=0xbfdc38) > at w32.c:701 > 701 HMODULE hm_advapi32 = NULL; > (gdb) bt > #0 lookup_account_sid (lpSystemName=0x0, Sid=0x1242d4, Name=0xbfdb30 > "\220\\q̨\177", cbName=0xbfdb2c, DomainName=0xbfd720 "P3\022", > cbDomainName=0xbfd71c, peUse=0xbfdc38) at w32.c:701 > #1 0x00007ff793792fa6 in get_name_and_id (psd=0x1242c0, id=0xbfeac0, > nm=0xbfeaf0 "ñ9Þ\003", what=1) at w32.c:5230 > #2 0x00007ff79379308b in get_file_owner_and_group (psd=0x1242c0, > st=0xbfeab0) at w32.c:5256 > #3 0x00007ff79379379f in stat_worker (path=0x7ff793da0043 > "Development\\emacs-emacs-29.4\\src\\", buf=0xbfeab0, > follow_symlinks=0) at w32.c:5504 > #4 0x00007ff793794217 in fstatat (fd=-3041965, name=0x3e7d408 > "c:/Development/emacs-emacs-29.4/src/", st=0xbfeab0, flags=4096) at > w32.c:5751 > #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=-3041965, > filename=0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > st=0xbfeab0, flags=4096) at sysdep.c:2338 > #6 0x00007ff793612ab9 in file_attributes (fd=-3041965, name=0x3e7d408 > "c:/Development/emacs-emacs-29.4/src/", dirname=0x0, > filename=0x3e839a4, id_format=0x0) at dired.c:1016 > #7 0x00007ff793612a1e in Ffile_attributes (filename=0x3e839a4, > id_format=0x0) at dired.c:962 > #8 0x00007ff7936810f6 in funcall_subr (subr=0x7ff793c824a0 > , numargs=1, args=0x4cbd070) at eval.c:3040 > #9 0x00007ff7936d99a3 in exec_byte_code (fun=0x44e227d, > args_template=513, nargs=2, args=0x4cbd200) at bytecode.c:809 > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=0x43ee9e5, > args_template=0, nargs=0, args=0xbff420) at eval.c:3085 > #11 0x00007ff793681899 in funcall_lambda (fun=0x43ee9e5, nargs=0, > arg_vector=0xbff420) at eval.c:3157 > #12 0x00007ff793681676 in apply_lambda (fun=0x43ee9e5, args=0x0, > count=...) at eval.c:3107 > #13 0x00007ff79367fb3f in eval_sub (form=0x48a614b) at eval.c:2549 > #14 0x00007ff79367f0af in Feval (form=0x48a614b, lexical=0x0) at eval.c:2365 > #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > #16 0x00007ff79367ce04 in internal_condition_case (bfun=0x7ff7935ae803 > , handlers=0x90, hfun=0x7ff7935adfad ) at > eval.c:1474 > #17 0x00007ff7935ae87c in top_level_1 (ignore=0x0) at keyboard.c:1150 > #18 0x00007ff79367c4ac in internal_catch (tag=0x103b0, > func=0x7ff7935ae82f , arg=0x0) at eval.c:1197 > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > #20 0x0000000000000000 in ?? () > (gdb) info locals > cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > 0x26065b0 "EDGE", peUse = SidTypeUser} > been_here_count = 3 > s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > hm_advapi32 = 0x0 > ret = 0 > (gdb) continue > Continuing. > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > Sid=0x1242f0, Name=0xbfdb30 "Vladimir.Sironja", cbName=0xbfdb2c, > DomainName=0xbfd720 "EDGE", cbDomainName=0xbfd71c, peUse=0xbfdc38) > at w32.c:701 > 701 HMODULE hm_advapi32 = NULL; > (gdb) bt > #0 lookup_account_sid (lpSystemName=0x0, Sid=0x1242f0, Name=0xbfdb30 > "Vladimir.Sironja", cbName=0xbfdb2c, DomainName=0xbfd720 "EDGE", > cbDomainName=0xbfd71c, peUse=0xbfdc38) at w32.c:701 > #1 0x00007ff793792fa6 in get_name_and_id (psd=0x1242c0, id=0xbfeac4, > nm=0xbfebf4 "", what=2) at w32.c:5230 > #2 0x00007ff7937930c2 in get_file_owner_and_group (psd=0x1242c0, > st=0xbfeab0) at w32.c:5258 > #3 0x00007ff79379379f in stat_worker (path=0x7ff793da0043 > "Development\\emacs-emacs-29.4\\src\\", buf=0xbfeab0, > follow_symlinks=0) at w32.c:5504 > #4 0x00007ff793794217 in fstatat (fd=-3041965, name=0x3e7d408 > "c:/Development/emacs-emacs-29.4/src/", st=0xbfeab0, flags=4096) at > w32.c:5751 > #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=-3041965, > filename=0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > st=0xbfeab0, flags=4096) at sysdep.c:2338 > #6 0x00007ff793612ab9 in file_attributes (fd=-3041965, name=0x3e7d408 > "c:/Development/emacs-emacs-29.4/src/", dirname=0x0, > filename=0x3e839a4, id_format=0x0) at dired.c:1016 > #7 0x00007ff793612a1e in Ffile_attributes (filename=0x3e839a4, > id_format=0x0) at dired.c:962 > #8 0x00007ff7936810f6 in funcall_subr (subr=0x7ff793c824a0 > , numargs=1, args=0x4cbd070) at eval.c:3040 > #9 0x00007ff7936d99a3 in exec_byte_code (fun=0x44e227d, > args_template=513, nargs=2, args=0x4cbd200) at bytecode.c:809 > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=0x43ee9e5, > args_template=0, nargs=0, args=0xbff420) at eval.c:3085 > #11 0x00007ff793681899 in funcall_lambda (fun=0x43ee9e5, nargs=0, > arg_vector=0xbff420) at eval.c:3157 > #12 0x00007ff793681676 in apply_lambda (fun=0x43ee9e5, args=0x0, > count=...) at eval.c:3107 > #13 0x00007ff79367fb3f in eval_sub (form=0x48a614b) at eval.c:2549 > #14 0x00007ff79367f0af in Feval (form=0x48a614b, lexical=0x0) at eval.c:2365 > #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > #16 0x00007ff79367ce04 in internal_condition_case (bfun=0x7ff7935ae803 > , handlers=0x90, hfun=0x7ff7935adfad ) at > eval.c:1474 > #17 0x00007ff7935ae87c in top_level_1 (ignore=0x0) at keyboard.c:1150 > #18 0x00007ff79367c4ac in internal_catch (tag=0x103b0, > func=0x7ff7935ae82f , arg=0x0) at eval.c:1197 > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > #20 0x0000000000000000 in ?? () > (gdb) info locals > cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > 0x26065b0 "EDGE", peUse = SidTypeUser} > been_here_count = 4 > s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > hm_advapi32 = 0x0 > ret = 0 > (gdb) continue > Continuing. > [New Thread 20812.0x4f7c] > [New Thread 20812.0x6d38] > [New Thread 20812.0x4a54] > > here emacs comes up. > > So for some reason been_here_count = 4. This tells me: . the first 2 calls are from init_user_info, where we obtain and record the user SID and the Group SID of your user . the next 2 calls are from file-attributes, where Emacs for some reason needed to obtain the owner and owner's group of the directory "c:/Development/emacs-emacs-29.4/src" These are different calls for different purposes: they obtain both the user and group SID (which are different SID values), and there's no guarantee that the directory "c:/Development/emacs-emacs-29.4/src" is necessarily owned by your user. So I don't see how caching could help here, and still produce the correct results. You could avoid the second pair of calls (and many similar calls in other cases where Emacs calls file-attributes) if you set the variable w32-get-true-file-attributes to the nil value. Maybe this makes startup faster in your case. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 11 10:04:30 2024 Received: (at 74311) by debbugs.gnu.org; 11 Nov 2024 15:04:30 +0000 Received: from localhost ([127.0.0.1]:58846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAVxt-0004Qq-DB for submit@debbugs.gnu.org; Mon, 11 Nov 2024 10:04:30 -0500 Received: from mail-yw1-f179.google.com ([209.85.128.179]:54469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAVAz-0001ze-7y for 74311@debbugs.gnu.org; Mon, 11 Nov 2024 09:13:58 -0500 Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-6ea053b5929so34406237b3.0 for <74311@debbugs.gnu.org>; Mon, 11 Nov 2024 06:13:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731334369; x=1731939169; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ALEUDBB4WwUkROLG302lZkBiMzQst/iopjM8s7xll0E=; b=JwMHJftWhJZ6KJbS9dprbvaSyRWiglgei/uGgNiYiQO25uPupFN/cHw0RaviAw22Mm QVvFuio9bHXOCsYU/nq4fQRBMybtg7toQRcedLrtpmODuCo1GDuTvcOYeIjp2ZA90um9 A3k1EJcxoysRcvceoIrJ8JOKTSx4SvvcdxD9k4Y5Pape8aJRPhgnLh+9+YMuGgdog0nd 60yEOQxprakqdEl+u/jcGqlt7auYP29P2Mi3pd+VFyt5gtFUwVthW4lQz+Qld7o1eYrw CAc68sHpwAJ+lhKyrgoUmijyx5hkDCrOdAh7jXwyaAMhYJsZJyh8liFXKkSBQnRou/Jx dTsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731334369; x=1731939169; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ALEUDBB4WwUkROLG302lZkBiMzQst/iopjM8s7xll0E=; b=ca8Qvj7n6AsYi5Fthr8AaxOZ5eFg5wHy60m8pPBRK260sgZzzrktx8LacpkOH9TqCw xPXut6rlVuPe6mBCTNpwUQNcFnNgcM5DMWwcqtCct/gx+tdMWGe/cf0ZxTALREtGftiu /kjBx+2nCaZUEmBqURttj3za8B0GgwFMeXG1zd/ou/k2Ibi9d+MM0mll+r8wkx4sxQyb OMiD9QhLwN9lBzLUoTS1K5fOWakBuv512gwJL5VAoSEiao7ldB8W+Ll83LFEiNM0TLCq S3xZWm09+Kz/vsf+rDiNwOSa6+7CXkD+8A58ddTadNaMAhuHSvWEBTriz3mOGV9FBqU1 UwmQ== X-Gm-Message-State: AOJu0YzMH2JUNlVZ16zY3orI/7etMTVroUIdeP/e+4aG/iSwIOr7NuDy KA8IlsBKV4OW6jMEft+A/E7TpRQQtkaOyxbupCbu4viHjUyyVZBOFQ9JseeB9STW1ZzufDm+w8w TG3NSZZULHFCz5zIlWQJq3K0R51s= X-Google-Smtp-Source: AGHT+IEfO4f7VFxN9cZftD18u4mVSnvbpBETYY3nFrncztnhoQCQhvjycQ818vbvqZRiTLoc4g1iO+EYj0e8ITENwiw= X-Received: by 2002:a05:690c:39b:b0:6dd:b983:8563 with SMTP id 00721157ae682-6eaddda0e0dmr115004807b3.14.1731334369375; Mon, 11 Nov 2024 06:12:49 -0800 (PST) MIME-Version: 1.0 References: <86v7wtkj5c.fsf@gnu.org> In-Reply-To: <86v7wtkj5c.fsf@gnu.org> From: =?UTF-8?Q?Vladimir_=C5=A0ironja?= Date: Mon, 11 Nov 2024 15:12:39 +0100 Message-ID: Subject: Re: bug#74311: Long startup time on windows (with simple fix) To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74311 X-Mailman-Approved-At: Mon, 11 Nov 2024 10:04:28 -0500 Cc: 74311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Eli, sorry, didn't quite understand which bugs should be separated, please advice again, 1) regarding netlogon, I do not really have an option disconnecting from DC 2) I have added a counter in line 695 like this: 685 static BOOL WINAPI 686 lookup_account_sid (LPCTSTR lpSystemName, 687 PSID Sid, 688 LPTSTR Name, 689 LPDWORD cbName, 690 LPTSTR DomainName, 691 LPDWORD cbDomainName, 692 PSID_NAME_USE peUse) 693 { 694 static struct lookup_account_sid_cache cache =3D { 0, NULL, NULL,= 0 }; 695 static unsigned been_here_count =3D 0; 696 697 ++been_here_count; 698 699 static LookupAccountSid_Proc s_pfn_Lookup_Account_Sid =3D NULL; 700 HMODULE hm_advapi32 =3D NULL; 701 if (is_windows_9x () =3D=3D TRUE) Here the debugger session: (gdb) b w32.c:701 Breakpoint 1 at 0x40031a8e0: file w32.c, line 701. (gdb) run Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe [New Thread 20812.0x73b4] [New Thread 20812.0x7bbc] [New Thread 20812.0x60fc] Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714b0, Name=3D0xbfe850 "=E2=94=94o\021", cbName=3D0xbfe32c, DomainName=3D0xbfe330 "b", cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 701 HMODULE hm_advapi32 =3D NULL; (gdb) bt #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714b0, Name=3D0xbfe85= 0 "=E2=94=94o\021", cbName=3D0xbfe32c, DomainName=3D0xbfe330 "b", cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 #1 0x00007ff79378d364 in init_user_info () at w32.c:2314 #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:3233 #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:2120 (gdb) continue Continuing. Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714a8, Name=3D0xbfe740 "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe320= , DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 701 HMODULE hm_advapi32 =3D NULL; (gdb) bt #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714a8, Name=3D0xbfe74= 0 "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe320, DomainName=3D0x0, cbDomainName= =3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 #1 0x00007ff79378d50c in init_user_info () at w32.c:2354 #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:3233 #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:2120 (gdb) info locals cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName =3D 0x26065b0 "EDGE", peUse =3D SidTypeUser} been_here_count =3D 2 s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 hm_advapi32 =3D 0x7ff9e0d50000 ret =3D 5 (gdb) continue Continuing. [New Thread 20812.0x4594] Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242d4, Name=3D0xbfdb30 "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbfdb2= c, DomainName=3D0xbfd720 "P3\022", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 701 HMODULE hm_advapi32 =3D NULL; (gdb) bt #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242d4, Name=3D0xbfdb30 "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "P3\022= ", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac0, nm=3D0xbfeaf0 "=C3=B19=C3=9E\003", what=3D1) at w32.c:5230 #2 0x00007ff79379308b in get_file_owner_and_group (psd=3D0x1242c0, st=3D0xbfeab0) at w32.c:5256 #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, follow_symlinks=3D0) at w32.c:5504 #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at w32.c:5751 #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, id_format=3D0x0) at dired.c:962 #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, arg_vector=3D0xbff420) at eval.c:3157 #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, count=3D...) at eval.c:3107 #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at eval.c= :2365 #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae803 , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at eval.c:1474 #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 #20 0x0000000000000000 in ?? () (gdb) info locals cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName =3D 0x26065b0 "EDGE", peUse =3D SidTypeUser} been_here_count =3D 3 s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 hm_advapi32 =3D 0x0 ret =3D 0 (gdb) continue Continuing. Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242f0, Name=3D0xbfdb30 "Vladimir.Sironja", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "EDGE", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 701 HMODULE hm_advapi32 =3D NULL; (gdb) bt #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242f0, Name=3D0xbfdb30 "Vladimir.Sironja", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "EDGE", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac4, nm=3D0xbfebf4 "", what=3D2) at w32.c:5230 #2 0x00007ff7937930c2 in get_file_owner_and_group (psd=3D0x1242c0, st=3D0xbfeab0) at w32.c:5258 #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, follow_symlinks=3D0) at w32.c:5504 #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at w32.c:5751 #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, id_format=3D0x0) at dired.c:962 #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, arg_vector=3D0xbff420) at eval.c:3157 #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, count=3D...) at eval.c:3107 #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at eval.c= :2365 #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae803 , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at eval.c:1474 #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 #20 0x0000000000000000 in ?? () (gdb) info locals cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName =3D 0x26065b0 "EDGE", peUse =3D SidTypeUser} been_here_count =3D 4 s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 hm_advapi32 =3D 0x0 ret =3D 0 (gdb) continue Continuing. [New Thread 20812.0x4f7c] [New Thread 20812.0x6d38] [New Thread 20812.0x4a54] here emacs comes up. So for some reason been_here_count =3D 4. ps. I understand that my simple fix does't work if first invocation incomplete with DomainName=3D=3DNULL On Mon, Nov 11, 2024 at 2:14=E2=80=AFPM Eli Zaretskii wrote: > > > From: Vladimir =C5=A0ironja > > Date: Mon, 11 Nov 2024 12:30:54 +0100 > > > > Hello, > > I have (*had!) a very annoying occurrence of long startup times on > > windows 10 & 11. > > Ended up with emacs 29.4 but tried several 28 and 26 versions with no > > difference. > > It takes sometimes around 30 secs for emacs to come up. > > But not always, let's say a third of strarts were normal within a secon= d. > > Tried excluding relevant directories from virus check; no difference. > > Also tried starting without init files (-Q); no difference. > > So compiled with debug symbols gcc version 14.2.0 on msys2. > > (Had to set manually add "#define HAVE_SYS_WAIT_H 1" into src/config.h > > - but that's another issue, already handled several times in this > > group.) > > > > In gdb-debugger caught the hanging operation: > > > > Thread 1 (Thread 19568.0x24c0): > > #0 0x00007ff9e2331244 in ntdll!ZwAlpcSendWaitReceivePort () from > > C:\WINDOWS\SYSTEM32\ntdll.dll > > #1 0x00007ff9e0a4b032 in RpcBindingFromStringBindingW () from > > C:\WINDOWS\System32\rpcrt4.dll > > #2 0x00007ff9e0a47efb in RpcBindingFromStringBindingW () from > > C:\WINDOWS\System32\rpcrt4.dll > > #3 0x00007ff9e0a66c19 in RPCRT4!I_RpcSendReceive () from > > C:\WINDOWS\System32\rpcrt4.dll > > #4 0x00007ff9e0a66b5f in RPCRT4!NdrSendReceive () from > > C:\WINDOWS\System32\rpcrt4.dll > > #5 0x00007ff9e0af07da in RPCRT4!NdrClientCall3 () from > > C:\WINDOWS\System32\rpcrt4.dll > > #6 0x00007ff9e0aef69b in RPCRT4!NdrClientCall3 () from > > C:\WINDOWS\System32\rpcrt4.dll > > #7 0x00007ff9e11c6046 in SECHOST!LookupAccountSidLocalW () from > > C:\WINDOWS\System32\sechost.dll > > #8 0x00007ff9e11c5d4f in SECHOST!LookupAccountSidLocalW () from > > C:\WINDOWS\System32\sechost.dll > > #9 0x00007ff9e11dead3 in SECHOST!LookupAccountSidLocalA () from > > C:\WINDOWS\System32\sechost.dll > > #10 0x00007ff9e0d9bce0 in LookupAccountSidA () from > > C:\WINDOWS\System32\advapi32.dll > > #11 0x00007ff63569a990 in lookup_account_sid (lpSystemName=3D0x0, > > Sid=3D0x4b414a8, Name=3D0xbfe740 "\030D=E2=95=A65\001", cbName=3D0xbfe3= 20, > > DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:7= 06 > > #12 0x00007ff63569d35f in init_user_info () at w32.c:2319 > > #13 0x00007ff63569f151 in init_environment (argv=3D0xd315b0) at w32.c:3= 198 > > #14 0x00007ff6354b93de in main (argc=3D1, argv=3D0xd315b0) at emacs.c:2= 120 > > So this is a completely different issue, and should have been > submitted as a separate bug report. > > > Ok, so noticed that it if s_pfn_Lookup_Account_Sid (LookupAccountSid) > > invoked for the *second* time, it blocks for around half a minute > > causing the delay. > > The questions is: why does it happen on your system. It doesn't > happen here on my Windows 11 system, and never happened on my previous > and other Windows systems where I use Emacs with this code. > > Are you working on a system under a domain controller, where Net Logon > service is enabled? We have a known problem described in > etc/PROBLEMS, with a possible solution; search for "Net Logon". > > If that solution helps, then maybe your Domain Controller is set up > sub-optimally, and need to be looked into. > > > I didn't analyse the cause for multiple invocations, but added a > > simple naive workaround to test the theory - which simply caches the > > results of LookupAccountSid. > > Caching the results of LookupAccountSid is problematic: the results > might change behind Emacs's back, and we have no good way of knowing > when that happens (to invalidate the cache). > > > Please change the code - to invoke the offending winapi function only > > once, since it obviously punishes the second caller. Or perhaps a > > caching mechanism as above. > > Can you show the backtraces for the two calls to LookupAccountSid? > The two calls inside lookup_account_sid are not identical: the first > gets information about the user, the second about its group. So if > you are talking about using just one of these two, then the results > will not be correct for the user's group. > > But if you see two calls to LookupAccountSid with the same arguments, > then please show the backtraces from these duplicate calls. > > P.S. If you want to keep discussing this bug further, please submit a > separate new bug report using "M-x report-emacs-bug". From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 11 10:19:30 2024 Received: (at 74311) by debbugs.gnu.org; 11 Nov 2024 15:19:30 +0000 Received: from localhost ([127.0.0.1]:58875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAWCP-00059u-IR for submit@debbugs.gnu.org; Mon, 11 Nov 2024 10:19:30 -0500 Received: from mail-oi1-f173.google.com ([209.85.167.173]:55388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tAWCN-00059m-GU for 74311@debbugs.gnu.org; Mon, 11 Nov 2024 10:19:28 -0500 Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3e600add5dcso2122842b6e.2 for <74311@debbugs.gnu.org>; Mon, 11 Nov 2024 07:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731338307; x=1731943107; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kWPC3mmksAJ2QyCt2s6kwDr10lP1o4R+Xts6sNMRpu4=; b=aUIIFPgExCNWgisKIPU6b+c0C1I91MxfmnbJ1KfLZer2sXjB3xA6xhIjXyKvtafYUe Ww1aaRCnB6OJhZVqriqkJEuM4F2VXSgEqPXsc83Y6lMocDZ6gUjKyMVZM0zve2RLPhVG A3fUF4mnB0+HsV3ItOyRCKSVKhdoNVMtz/qxAZMTfMNga5+o5IsJiOB/N5Jt4DiBpDxc VH6XTQ0m7qXWDI8SOsuSnZj6V36ne0OJ2lDPD4acZUZHOtuRzG3eYtVh8IO5uH1J0bOd qRsc0NLfYH31shuMF7uOJca4KO8hwZQJl1ThVdypwoJNZ5LTbYqteFZIg0gvb2bpz/IZ +Exw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731338307; x=1731943107; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kWPC3mmksAJ2QyCt2s6kwDr10lP1o4R+Xts6sNMRpu4=; b=Oc2KeZ3dnC8MYj6YLs5fhdLJ5cT/S6drRGmf4QwIv9iHm/U7jcLKbPtFJJSH//ibI/ GVGt0ij4mzt34o6iGu5DaOHRfWK8hkz4WhMDcIJLmsHRIHGmQWUgS+JP28wXgG1cLdUw Lg0oyqDUzmxDORLO64yBfOLo4DpMoRypvTeazTijAvwxsHScXLr9zOgdGWXLsq6sA7Bl sBjWJJiXuNBDPQ0tr0CWkV82zNr/XNIN+z1Ol4DWn5s88ibV+1/XiYBANHKp+ZGqJgBg 6EG+xRpIFOtBX/21lTG1lE8sfMj2yhpLsHss6n12GDZ39+jkehjsi/JbhY/id8O/VnT7 Dw7Q== X-Forwarded-Encrypted: i=1; AJvYcCUjHZNOd+QEh9YQsJoZT86ZK3HPjt89FcNTxuR+v6Zp9NGyuv66kbr4dI9LZ5XuuKYgesCnCw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yy+uta2CT9Z5uj6dDiAxoIwk2pXtvH1obw2uWdSd/bSPdFeeDQi ufm5eDAyLmua3PIkV7Fyy2+bAG7Qk8p0b7z+mv5sK6jfFHNyvaWQnikwvn7S0F7E+DzZF6YX40k CITxzUuNDGuLeX/4lc/vcKXpKwRY= X-Google-Smtp-Source: AGHT+IFfye/NvLKidE7oOOvOdeUlHnLSyFOg22FpfIe2K7Iw/Cw+zZ2b+fWpRifuc8mMESXIpGxsGrquRDOoy+xaftI= X-Received: by 2002:a05:6358:2197:b0:1b8:341e:d68 with SMTP id e5c5f4694b2df-1c641f6d970mr466813255d.24.1731338306633; Mon, 11 Nov 2024 07:18:26 -0800 (PST) MIME-Version: 1.0 References: <86v7wtkj5c.fsf@gnu.org> <86ttcdkeuu.fsf@gnu.org> In-Reply-To: <86ttcdkeuu.fsf@gnu.org> From: Ship Mints Date: Mon, 11 Nov 2024 10:18:15 -0500 Message-ID: Subject: Re: bug#74311: Long startup time on windows (with simple fix) To: Eli Zaretskii Content-Type: multipart/alternative; boundary="000000000000c0ccff0626a49cce" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74311 Cc: =?UTF-8?Q?Vladimir_=C5=A0ironja?= , 74311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000c0ccff0626a49cce Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Smells like anti-virus or some other third-party drivers interfering. I wonder if this is on a corporate computer or personal one. If personal, it should be easy to temporarily disable potentially interfering tools. On Mon, Nov 11, 2024 at 9:47=E2=80=AFAM Eli Zaretskii wrote: > > From: Vladimir =C5=A0ironja > > Date: Mon, 11 Nov 2024 15:12:39 +0100 > > Cc: 74311@debbugs.gnu.org > > > > sorry, didn't quite understand which bugs should be separated, please > > advice again, > > Sorry, my misunderstanding, please ignore that part. > > > 1) regarding netlogon, I do not really have an option disconnecting fro= m > DC > > Canj you at least try it once, to see if that is the root cause? > > > Here the debugger session: > > > > (gdb) b w32.c:701 > > Breakpoint 1 at 0x40031a8e0: file w32.c, line 701. > > (gdb) run > > Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe > > [New Thread 20812.0x73b4] > > [New Thread 20812.0x7bbc] > > [New Thread 20812.0x60fc] > > > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, > > Sid=3D0x3e714b0, Name=3D0xbfe850 "=E2=94=94o\021", cbName=3D0xbfe32c, > > DomainName=3D0xbfe330 "b", cbDomainName=3D0xbfe328, peUse=3D0xbfe314) a= t > > w32.c:701 > > 701 HMODULE hm_advapi32 =3D NULL; > > (gdb) bt > > #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714b0, Name=3D0xb= fe850 > > "=E2=94=94o\021", cbName=3D0xbfe32c, DomainName=3D0xbfe330 "b", > > cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 > > #1 0x00007ff79378d364 in init_user_info () at w32.c:2314 > > #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:= 3233 > > #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:= 2120 > > (gdb) continue > > Continuing. > > > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, > > Sid=3D0x3e714a8, Name=3D0xbfe740 "XD=E2=94=8C=C3=B4\001", cbName=3D0xbf= e320, > > DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:7= 01 > > 701 HMODULE hm_advapi32 =3D NULL; > > (gdb) bt > > #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714a8, Name=3D0xb= fe740 > > "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe320, DomainName=3D0x0, cbDomainN= ame=3D0xbfe328, > > peUse=3D0xbfe314) at w32.c:701 > > #1 0x00007ff79378d50c in init_user_info () at w32.c:2354 > > #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:= 3233 > > #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:= 2120 > > (gdb) info locals > > cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName= =3D > > 0x26065b0 "EDGE", peUse =3D SidTypeUser} > > been_here_count =3D 2 > > s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 > > hm_advapi32 =3D 0x7ff9e0d50000 > > ret =3D 5 > > (gdb) continue > > Continuing. > > [New Thread 20812.0x4594] > > > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, > > Sid=3D0x1242d4, Name=3D0xbfdb30 "\220\\q=C3=8C=C2=A8\177", cbName=3D0xb= fdb2c, > > DomainName=3D0xbfd720 "P3\022", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc= 38) > > at w32.c:701 > > 701 HMODULE hm_advapi32 =3D NULL; > > (gdb) bt > > #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242d4, Name=3D0xbf= db30 > > "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "P3= \022", > > cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 > > #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac= 0, > > nm=3D0xbfeaf0 "=C3=B19=C3=9E\003", what=3D1) at w32.c:5230 > > #2 0x00007ff79379308b in get_file_owner_and_group (psd=3D0x1242c0, > > st=3D0xbfeab0) at w32.c:5256 > > #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 > > "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, > > follow_symlinks=3D0) at w32.c:5504 > > #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 > > "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at > > w32.c:5751 > > #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, > > filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > > st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 > > #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d= 408 > > "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, > > filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 > > #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, > > id_format=3D0x0) at dired.c:962 > > #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 > > , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 > > #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, > > args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 > > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, > > args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 > > #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, > > arg_vector=3D0xbff420) at eval.c:3157 > > #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, > > count=3D...) at eval.c:3107 > > #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 > > #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at > eval.c:2365 > > #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > > #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae80= 3 > > , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at > > eval.c:1474 > > #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 > > #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, > > func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 > > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > > #20 0x0000000000000000 in ?? () > > (gdb) info locals > > cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName= =3D > > 0x26065b0 "EDGE", peUse =3D SidTypeUser} > > been_here_count =3D 3 > > s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 > > hm_advapi32 =3D 0x0 > > ret =3D 0 > > (gdb) continue > > Continuing. > > > > Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, > > Sid=3D0x1242f0, Name=3D0xbfdb30 "Vladimir.Sironja", cbName=3D0xbfdb2c, > > DomainName=3D0xbfd720 "EDGE", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38= ) > > at w32.c:701 > > 701 HMODULE hm_advapi32 =3D NULL; > > (gdb) bt > > #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242f0, Name=3D0xbf= db30 > > "Vladimir.Sironja", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "EDGE", > > cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 > > #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac= 4, > > nm=3D0xbfebf4 "", what=3D2) at w32.c:5230 > > #2 0x00007ff7937930c2 in get_file_owner_and_group (psd=3D0x1242c0, > > st=3D0xbfeab0) at w32.c:5258 > > #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 > > "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, > > follow_symlinks=3D0) at w32.c:5504 > > #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 > > "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at > > w32.c:5751 > > #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, > > filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > > st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 > > #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d= 408 > > "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, > > filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 > > #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, > > id_format=3D0x0) at dired.c:962 > > #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 > > , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 > > #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, > > args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 > > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, > > args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 > > #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, > > arg_vector=3D0xbff420) at eval.c:3157 > > #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, > > count=3D...) at eval.c:3107 > > #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 > > #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at > eval.c:2365 > > #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > > #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae80= 3 > > , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at > > eval.c:1474 > > #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 > > #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, > > func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 > > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > > #20 0x0000000000000000 in ?? () > > (gdb) info locals > > cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName= =3D > > 0x26065b0 "EDGE", peUse =3D SidTypeUser} > > been_here_count =3D 4 > > s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 > > hm_advapi32 =3D 0x0 > > ret =3D 0 > > (gdb) continue > > Continuing. > > [New Thread 20812.0x4f7c] > > [New Thread 20812.0x6d38] > > [New Thread 20812.0x4a54] > > > > here emacs comes up. > > > > So for some reason been_here_count =3D 4. > > This tells me: > > . the first 2 calls are from init_user_info, where we obtain and > record the user SID and the Group SID of your user > . the next 2 calls are from file-attributes, where Emacs for some > reason needed to obtain the owner and owner's group of the > directory "c:/Development/emacs-emacs-29.4/src" > > These are different calls for different purposes: they obtain both the > user and group SID (which are different SID values), and there's no > guarantee that the directory "c:/Development/emacs-emacs-29.4/src" is > necessarily owned by your user. > > So I don't see how caching could help here, and still produce the > correct results. > > You could avoid the second pair of calls (and many similar calls in > other cases where Emacs calls file-attributes) if you set the variable > w32-get-true-file-attributes to the nil value. Maybe this makes > startup faster in your case. > > > > --000000000000c0ccff0626a49cce Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Smells like anti-virus or some other third-party drivers interfering. I = wonder if this is on a corporate computer or personal one. If personal, it = should be easy to temporarily disable potentially interfering tools.=C2=A0<= /div>

On Mon, Nov 11, 2024 at 9:47=E2=80=AFAM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Vladimir =C5=A0ironja <vladimir.sironja= @gmail.com>
> Date: Mon, 11 Nov 2024 15:12:39 +0100
> Cc: 74311@d= ebbugs.gnu.org
>
> sorry, didn't quite understand which bugs should be separated, ple= ase
> advice again,

Sorry, my misunderstanding, please ignore that part.

> 1) regarding netlogon, I do not really have an option disconnecting fr= om DC

Canj you at least try it once, to see if that is the root cause?

> Here the debugger session:
>
> (gdb) b w32.c:701
> Breakpoint 1 at 0x40031a8e0: file w32.c, line 701.
> (gdb) run
> Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe
> [New Thread 20812.0x73b4]
> [New Thread 20812.0x7bbc]
> [New Thread 20812.0x60fc]
>
> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0,
> Sid=3D0x3e714b0, Name=3D0xbfe850 "=E2=94=94o\021", cbName=3D= 0xbfe32c,
> DomainName=3D0xbfe330 "b", cbDomainName=3D0xbfe328, peUse=3D= 0xbfe314) at
> w32.c:701
> 701=C2=A0 =C2=A0 =C2=A0 =C2=A0HMODULE hm_advapi32 =3D NULL;
> (gdb) bt
> #0=C2=A0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714b0, Name= =3D0xbfe850
> "=E2=94=94o\021", cbName=3D0xbfe32c, DomainName=3D0xbfe330 &= quot;b",
> cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701
> #1=C2=A0 0x00007ff79378d364 in init_user_info () at w32.c:2314
> #2=C2=A0 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at = w32.c:3233
> #3=C2=A0 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at em= acs.c:2120
> (gdb) continue
> Continuing.
>
> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0,
> Sid=3D0x3e714a8, Name=3D0xbfe740 "XD=E2=94=8C=C3=B4\001", cb= Name=3D0xbfe320,
> DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:= 701
> 701=C2=A0 =C2=A0 =C2=A0 =C2=A0HMODULE hm_advapi32 =3D NULL;
> (gdb) bt
> #0=C2=A0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714a8, Name= =3D0xbfe740
> "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe320, DomainName=3D0x0= , cbDomainName=3D0xbfe328,
> peUse=3D0xbfe314) at w32.c:701
> #1=C2=A0 0x00007ff79378d50c in init_user_info () at w32.c:2354
> #2=C2=A0 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at = w32.c:3233
> #3=C2=A0 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at em= acs.c:2120
> (gdb) info locals
> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja",= DomainName =3D
> 0x26065b0 "EDGE", peUse =3D SidTypeUser}
> been_here_count =3D 2
> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 <LookupAccountSidA><= br> > hm_advapi32 =3D 0x7ff9e0d50000
> ret =3D 5
> (gdb) continue
> Continuing.
> [New Thread 20812.0x4594]
>
> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0,
> Sid=3D0x1242d4, Name=3D0xbfdb30 "\220\\q=C3=8C=C2=A8\177", c= bName=3D0xbfdb2c,
> DomainName=3D0xbfd720 "P3\022", cbDomainName=3D0xbfd71c, peU= se=3D0xbfdc38)
>=C2=A0 =C2=A0 =C2=A0at w32.c:701
> 701=C2=A0 =C2=A0 =C2=A0 =C2=A0HMODULE hm_advapi32 =3D NULL;
> (gdb) bt
> #0=C2=A0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242d4, Name= =3D0xbfdb30
> "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbfdb2c, DomainName=3D0= xbfd720 "P3\022",
> cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701
> #1=C2=A0 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0= xbfeac0,
> nm=3D0xbfeaf0 "=C3=B19=C3=9E\003", what=3D1) at w32.c:5230 > #2=C2=A0 0x00007ff79379308b in get_file_owner_and_group (psd=3D0x1242c= 0,
> st=3D0xbfeab0) at w32.c:5256
> #3=C2=A0 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043
> <shortname+3> "Development\\emacs-emacs-29.4\\src\\", = buf=3D0xbfeab0,
> follow_symlinks=3D0) at w32.c:5504
> #4=C2=A0 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d40= 8
> "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags= =3D4096) at
> w32.c:5751
> #5=C2=A0 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965,
> filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/",=
> st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338
> #6=C2=A0 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D= 0x3e7d408
> "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0,
> filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016
> #7=C2=A0 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4,=
> id_format=3D0x0) at dired.c:962
> #8=C2=A0 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0
> <Sfile_attributes>, numargs=3D1, args=3D0x4cbd070) at eval.c:304= 0
> #9=C2=A0 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d,
> args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, > args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085
> #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0,<= br> > arg_vector=3D0xbff420) at eval.c:3157
> #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, > count=3D...) at eval.c:3107
> #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 > #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at e= val.c:2365
> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142
> #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae8= 03
> <top_level_2>, handlers=3D0x90, hfun=3D0x7ff7935adfad <cmd_er= ror>) at
> eval.c:1474
> #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:115= 0
> #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0,
> func=3D0x7ff7935ae82f <top_level_1>, arg=3D0x0) at eval.c:1197 > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110
> #20 0x0000000000000000 in ?? ()
> (gdb) info locals
> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja",= DomainName =3D
> 0x26065b0 "EDGE", peUse =3D SidTypeUser}
> been_here_count =3D 3
> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 <LookupAccountSidA><= br> > hm_advapi32 =3D 0x0
> ret =3D 0
> (gdb) continue
> Continuing.
>
> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0,
> Sid=3D0x1242f0, Name=3D0xbfdb30 "Vladimir.Sironja", cbName= =3D0xbfdb2c,
> DomainName=3D0xbfd720 "EDGE", cbDomainName=3D0xbfd71c, peUse= =3D0xbfdc38)
>=C2=A0 =C2=A0 =C2=A0at w32.c:701
> 701=C2=A0 =C2=A0 =C2=A0 =C2=A0HMODULE hm_advapi32 =3D NULL;
> (gdb) bt
> #0=C2=A0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242f0, Name= =3D0xbfdb30
> "Vladimir.Sironja", cbName=3D0xbfdb2c, DomainName=3D0xbfd720= "EDGE",
> cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701
> #1=C2=A0 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0= xbfeac4,
> nm=3D0xbfebf4 "", what=3D2) at w32.c:5230
> #2=C2=A0 0x00007ff7937930c2 in get_file_owner_and_group (psd=3D0x1242c= 0,
> st=3D0xbfeab0) at w32.c:5258
> #3=C2=A0 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043
> <shortname+3> "Development\\emacs-emacs-29.4\\src\\", = buf=3D0xbfeab0,
> follow_symlinks=3D0) at w32.c:5504
> #4=C2=A0 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d40= 8
> "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags= =3D4096) at
> w32.c:5751
> #5=C2=A0 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965,
> filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/",=
> st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338
> #6=C2=A0 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D= 0x3e7d408
> "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0,
> filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016
> #7=C2=A0 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4,=
> id_format=3D0x0) at dired.c:962
> #8=C2=A0 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0
> <Sfile_attributes>, numargs=3D1, args=3D0x4cbd070) at eval.c:304= 0
> #9=C2=A0 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d,
> args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 > #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, > args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085
> #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0,<= br> > arg_vector=3D0xbff420) at eval.c:3157
> #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, > count=3D...) at eval.c:3107
> #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 > #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at e= val.c:2365
> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142
> #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae8= 03
> <top_level_2>, handlers=3D0x90, hfun=3D0x7ff7935adfad <cmd_er= ror>) at
> eval.c:1474
> #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:115= 0
> #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0,
> func=3D0x7ff7935ae82f <top_level_1>, arg=3D0x0) at eval.c:1197 > #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110
> #20 0x0000000000000000 in ?? ()
> (gdb) info locals
> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja",= DomainName =3D
> 0x26065b0 "EDGE", peUse =3D SidTypeUser}
> been_here_count =3D 4
> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 <LookupAccountSidA><= br> > hm_advapi32 =3D 0x0
> ret =3D 0
> (gdb) continue
> Continuing.
> [New Thread 20812.0x4f7c]
> [New Thread 20812.0x6d38]
> [New Thread 20812.0x4a54]
>
> here emacs comes=C2=A0 up.
>
> So for some reason been_here_count =3D 4.

This tells me:

=C2=A0 . the first 2 calls are from init_user_info, where we obtain and
=C2=A0 =C2=A0 record the user SID and the Group SID of your user
=C2=A0 . the next 2 calls are from file-attributes, where Emacs for some =C2=A0 =C2=A0 reason needed to obtain the owner and owner's group of th= e
=C2=A0 =C2=A0 directory "c:/Development/emacs-emacs-29.4/src"

These are different calls for different purposes: they obtain both the
user and group SID (which are different SID values), and there's no
guarantee that the directory "c:/Development/emacs-emacs-29.4/src"= ; is
necessarily owned by your user.

So I don't see how caching could help here, and still produce the
correct results.

You could avoid the second pair of calls (and many similar calls in
other cases where Emacs calls file-attributes) if you set the variable
w32-get-true-file-attributes to the nil value.=C2=A0 Maybe this makes
startup faster in your case.



--000000000000c0ccff0626a49cce-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 01 21:03:14 2025 Received: (at 74311) by debbugs.gnu.org; 2 Jan 2025 02:03:14 +0000 Received: from localhost ([127.0.0.1]:41409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTAYL-0002VN-Hr for submit@debbugs.gnu.org; Wed, 01 Jan 2025 21:03:14 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:43478) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tTAYI-0002Uu-GH for 74311@debbugs.gnu.org; Wed, 01 Jan 2025 21:03:11 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5d3f57582a2so21058578a12.1 for <74311@debbugs.gnu.org>; Wed, 01 Jan 2025 18:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735783384; x=1736388184; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=SDYUEa7Caus3TVk89ecwZJqAhxKBTdkWUH6ewdB8EJ0=; b=TPrxUDgILxVKrZX8T1EoSBwRjEOZQRfbWyEbTaoWjYZXixkaCbCjOilv0kRHdJMWCj TIY1Fn5kiig3fbe15DTr82HxGIdnhD+iz10YzC/ddNLEOBi+pbHwGbEVZND5ZI/tcOKh SliSGkXoycq/4tjp3jvF9zaBtrBtolfAZZnDVCNQL0TOgEqSCJHIqpEuGY1fHVJmqpv1 h0sHKhyvPf+2YAaO0xRGrQVNzd78CM0ti5Tblwit9kVkZyYfMsXEW3WSfbnUwS65vxKg kfbip7qG+tk28gfDf2Sv9kFTn3w7TmiP0Q/IoekiN/bsqxW1R8qOus7OtBcnHgq8RZvF DglQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735783384; x=1736388184; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SDYUEa7Caus3TVk89ecwZJqAhxKBTdkWUH6ewdB8EJ0=; b=MMxi3PzXKEj7+/X6v/FsRb3h/zqZSfRo7HnZpxZ2wOBpTjdWnRMpAQLSQahhd3HAqM S3EBpddI7swDCYJuh/TjX83Fpp1MulDIzDfVZJD8UMhdPp7nXCaW0izKWrEbPcS2g2Jv CLdXXlW2qStGRanfoNCuAdrLTZryh3iziV/uAu1s94keR/GxdqsNLOQL5QLWB2ZaSdEh 9sTo2nomKtPZIUCOqz6Rg0EYM9udCrdyV/JwjfNXN+GBPTkZ0/tudJt84kXJ6YzeMI+8 mCz/oRq6CZONbYE9UlF73d17TQId+mo9NXK58onTJP8Sk1VJklnS2Z2QiryAWYDz8MR7 ktwQ== X-Forwarded-Encrypted: i=1; AJvYcCVdJNKbdTJAB/vEZKQxkJeiULzak/cmu8+MJGph70fqhVSOjtXQSqUJRpG0HYR8uKhLzKGqZw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yxh1/YI0qDDR9WeEy4IgW3Z2aOqoP5HTVqzqI0ELyy30XE0NEuy O5U6itmWWAVwudJz/iOU+ikd40K6uG3tstJ1I6NST5X8qA+k28AjnS0JrNqpQP1UkvwPFfkjIAl udw1hOrEphmMeXatRyX34StcLHv0= X-Gm-Gg: ASbGncuhPNJ0q7CBrDR13rA83RjpK+I4Qty5lmTQDGpbKhhm3CpBXeSYcUcuJhKVfEC 59ZDX/WMV7hHMG8QggYCn7C6gf87777OSrsYKV69M X-Google-Smtp-Source: AGHT+IFCSndA+By5BsfIZ8N1c223ylqU0ebH/PHeH1m+63ZKljkgXimk8vJkFERf7iS3CnYPlUPyDBgONQ58oiXdHXg= X-Received: by 2002:a05:6402:2115:b0:5d0:7a0b:b45f with SMTP id 4fb4d7f45d1cf-5d8023a1343mr44212912a12.10.1735783384294; Wed, 01 Jan 2025 18:03:04 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 1 Jan 2025 20:03:04 -0600 From: Stefan Kangas In-Reply-To: <86ttcdkeuu.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 11 Nov 2024 16:46:33 +0200") References: <86v7wtkj5c.fsf@gnu.org> <86ttcdkeuu.fsf@gnu.org> MIME-Version: 1.0 Date: Wed, 1 Jan 2025 20:03:04 -0600 Message-ID: Subject: Re: bug#74311: Long startup time on windows (with simple fix) To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74311 Cc: =?UTF-8?Q?Vladimir_=C5=A0ironja?= , 74311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Vladimir =C5=A0ironja >> Date: Mon, 11 Nov 2024 15:12:39 +0100 >> Cc: 74311@debbugs.gnu.org >> >> sorry, didn't quite understand which bugs should be separated, please >> advice again, > > Sorry, my misunderstanding, please ignore that part. > >> 1) regarding netlogon, I do not really have an option disconnecting from= DC > > Canj you at least try it once, to see if that is the root cause? > >> Here the debugger session: >> >> (gdb) b w32.c:701 >> Breakpoint 1 at 0x40031a8e0: file w32.c, line 701. >> (gdb) run >> Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe >> [New Thread 20812.0x73b4] >> [New Thread 20812.0x7bbc] >> [New Thread 20812.0x60fc] >> >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, >> Sid=3D0x3e714b0, Name=3D0xbfe850 "=E2=94=94o\021", cbName=3D0xbfe32c, >> DomainName=3D0xbfe330 "b", cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at >> w32.c:701 >> 701 HMODULE hm_advapi32 =3D NULL; >> (gdb) bt >> #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714b0, Name=3D0xbf= e850 >> "=E2=94=94o\021", cbName=3D0xbfe32c, DomainName=3D0xbfe330 "b", >> cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:701 >> #1 0x00007ff79378d364 in init_user_info () at w32.c:2314 >> #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:3= 233 >> #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:2= 120 >> (gdb) continue >> Continuing. >> >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, >> Sid=3D0x3e714a8, Name=3D0xbfe740 "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe= 320, >> DomainName=3D0x0, cbDomainName=3D0xbfe328, peUse=3D0xbfe314) at w32.c:70= 1 >> 701 HMODULE hm_advapi32 =3D NULL; >> (gdb) bt >> #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x3e714a8, Name=3D0xbf= e740 >> "XD=E2=94=8C=C3=B4\001", cbName=3D0xbfe320, DomainName=3D0x0, cbDomainNa= me=3D0xbfe328, >> peUse=3D0xbfe314) at w32.c:701 >> #1 0x00007ff79378d50c in init_user_info () at w32.c:2354 >> #2 0x00007ff79378f2fe in init_environment (argv=3D0x26015b0) at w32.c:3= 233 >> #3 0x00007ff7935a93de in main (argc=3D1, argv=3D0x26015b0) at emacs.c:2= 120 >> (gdb) info locals >> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName = =3D >> 0x26065b0 "EDGE", peUse =3D SidTypeUser} >> been_here_count =3D 2 >> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 >> hm_advapi32 =3D 0x7ff9e0d50000 >> ret =3D 5 >> (gdb) continue >> Continuing. >> [New Thread 20812.0x4594] >> >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, >> Sid=3D0x1242d4, Name=3D0xbfdb30 "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbf= db2c, >> DomainName=3D0xbfd720 "P3\022", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc3= 8) >> at w32.c:701 >> 701 HMODULE hm_advapi32 =3D NULL; >> (gdb) bt >> #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242d4, Name=3D0xbfd= b30 >> "\220\\q=C3=8C=C2=A8\177", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "P3\= 022", >> cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 >> #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac0= , >> nm=3D0xbfeaf0 "=C3=B19=C3=9E\003", what=3D1) at w32.c:5230 >> #2 0x00007ff79379308b in get_file_owner_and_group (psd=3D0x1242c0, >> st=3D0xbfeab0) at w32.c:5256 >> #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 >> "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, >> follow_symlinks=3D0) at w32.c:5504 >> #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 >> "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at >> w32.c:5751 >> #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, >> filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", >> st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 >> #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d4= 08 >> "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, >> filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 >> #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, >> id_format=3D0x0) at dired.c:962 >> #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 >> , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 >> #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, >> args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 >> #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, >> args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 >> #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, >> arg_vector=3D0xbff420) at eval.c:3157 >> #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, >> count=3D...) at eval.c:3107 >> #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 >> #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at eva= l.c:2365 >> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 >> #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae803 >> , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at >> eval.c:1474 >> #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 >> #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, >> func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 >> #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 >> #20 0x0000000000000000 in ?? () >> (gdb) info locals >> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName = =3D >> 0x26065b0 "EDGE", peUse =3D SidTypeUser} >> been_here_count =3D 3 >> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 >> hm_advapi32 =3D 0x0 >> ret =3D 0 >> (gdb) continue >> Continuing. >> >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=3D0x0, >> Sid=3D0x1242f0, Name=3D0xbfdb30 "Vladimir.Sironja", cbName=3D0xbfdb2c, >> DomainName=3D0xbfd720 "EDGE", cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) >> at w32.c:701 >> 701 HMODULE hm_advapi32 =3D NULL; >> (gdb) bt >> #0 lookup_account_sid (lpSystemName=3D0x0, Sid=3D0x1242f0, Name=3D0xbfd= b30 >> "Vladimir.Sironja", cbName=3D0xbfdb2c, DomainName=3D0xbfd720 "EDGE", >> cbDomainName=3D0xbfd71c, peUse=3D0xbfdc38) at w32.c:701 >> #1 0x00007ff793792fa6 in get_name_and_id (psd=3D0x1242c0, id=3D0xbfeac4= , >> nm=3D0xbfebf4 "", what=3D2) at w32.c:5230 >> #2 0x00007ff7937930c2 in get_file_owner_and_group (psd=3D0x1242c0, >> st=3D0xbfeab0) at w32.c:5258 >> #3 0x00007ff79379379f in stat_worker (path=3D0x7ff793da0043 >> "Development\\emacs-emacs-29.4\\src\\", buf=3D0xbfeab0, >> follow_symlinks=3D0) at w32.c:5504 >> #4 0x00007ff793794217 in fstatat (fd=3D-3041965, name=3D0x3e7d408 >> "c:/Development/emacs-emacs-29.4/src/", st=3D0xbfeab0, flags=3D4096) at >> w32.c:5751 >> #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=3D-3041965, >> filename=3D0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", >> st=3D0xbfeab0, flags=3D4096) at sysdep.c:2338 >> #6 0x00007ff793612ab9 in file_attributes (fd=3D-3041965, name=3D0x3e7d4= 08 >> "c:/Development/emacs-emacs-29.4/src/", dirname=3D0x0, >> filename=3D0x3e839a4, id_format=3D0x0) at dired.c:1016 >> #7 0x00007ff793612a1e in Ffile_attributes (filename=3D0x3e839a4, >> id_format=3D0x0) at dired.c:962 >> #8 0x00007ff7936810f6 in funcall_subr (subr=3D0x7ff793c824a0 >> , numargs=3D1, args=3D0x4cbd070) at eval.c:3040 >> #9 0x00007ff7936d99a3 in exec_byte_code (fun=3D0x44e227d, >> args_template=3D513, nargs=3D2, args=3D0x4cbd200) at bytecode.c:809 >> #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=3D0x43ee9e5, >> args_template=3D0, nargs=3D0, args=3D0xbff420) at eval.c:3085 >> #11 0x00007ff793681899 in funcall_lambda (fun=3D0x43ee9e5, nargs=3D0, >> arg_vector=3D0xbff420) at eval.c:3157 >> #12 0x00007ff793681676 in apply_lambda (fun=3D0x43ee9e5, args=3D0x0, >> count=3D...) at eval.c:3107 >> #13 0x00007ff79367fb3f in eval_sub (form=3D0x48a614b) at eval.c:2549 >> #14 0x00007ff79367f0af in Feval (form=3D0x48a614b, lexical=3D0x0) at eva= l.c:2365 >> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 >> #16 0x00007ff79367ce04 in internal_condition_case (bfun=3D0x7ff7935ae803 >> , handlers=3D0x90, hfun=3D0x7ff7935adfad ) at >> eval.c:1474 >> #17 0x00007ff7935ae87c in top_level_1 (ignore=3D0x0) at keyboard.c:1150 >> #18 0x00007ff79367c4ac in internal_catch (tag=3D0x103b0, >> func=3D0x7ff7935ae82f , arg=3D0x0) at eval.c:1197 >> #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 >> #20 0x0000000000000000 in ?? () >> (gdb) info locals >> cache =3D {ret =3D 1, Name =3D 0x2606560 "Vladimir.Sironja", DomainName = =3D >> 0x26065b0 "EDGE", peUse =3D SidTypeUser} >> been_here_count =3D 4 >> s_pfn_Lookup_Account_Sid =3D 0x7ff9e0d9bc20 >> hm_advapi32 =3D 0x0 >> ret =3D 0 >> (gdb) continue >> Continuing. >> [New Thread 20812.0x4f7c] >> [New Thread 20812.0x6d38] >> [New Thread 20812.0x4a54] >> >> here emacs comes up. >> >> So for some reason been_here_count =3D 4. > > This tells me: > > . the first 2 calls are from init_user_info, where we obtain and > record the user SID and the Group SID of your user > . the next 2 calls are from file-attributes, where Emacs for some > reason needed to obtain the owner and owner's group of the > directory "c:/Development/emacs-emacs-29.4/src" > > These are different calls for different purposes: they obtain both the > user and group SID (which are different SID values), and there's no > guarantee that the directory "c:/Development/emacs-emacs-29.4/src" is > necessarily owned by your user. > > So I don't see how caching could help here, and still produce the > correct results. > > You could avoid the second pair of calls (and many similar calls in > other cases where Emacs calls file-attributes) if you set the variable > w32-get-true-file-attributes to the nil value. Maybe this makes > startup faster in your case. Does that mean that we should close this as wontfix? From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 02 01:14:34 2025 Received: (at 74311-done) by debbugs.gnu.org; 2 Jan 2025 06:14:34 +0000 Received: from localhost ([127.0.0.1]:42420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTETZ-0006IE-SB for submit@debbugs.gnu.org; Thu, 02 Jan 2025 01:14:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49656) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTETX-0006HW-86 for 74311-done@debbugs.gnu.org; Thu, 02 Jan 2025 01:14:32 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTETR-0006ge-Sr; Thu, 02 Jan 2025 01:14:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Sti0Kqo7NIviSokdSUi5+jsuis62c4RnWq590VSr5pQ=; b=Z3NYeFO6GeYws95SrbVY xTLuPlf0TsoWcwJ3By6iFMIhu4G4dYFVTZnOyKW57Ftf7Wm/YsOMeVqImMfKuHmmDUPwV05hJCVTH rtsLfQXyEm/iT12onef5v5uUOLj/bUv0vUJDXbmD6EuMfHBZMSczp/EM+R9GkjeIJeuGNUGiDRwaF vab0qkZ6ghyvoZP0LKEYHyg5ay6Zk1uqa5yJo/vIQhbaQ1cRppNOoJteZXzXQx+uEl7c+quZjOxcE bM2nH1XgY9zrP5lpeDwAy37+ZWYaeaBqsqW4OLNIHNWyvi24UEFVz4TKGHT1YcjmKn3Ptc7JgcuS1 UO7l5rg7viIQHQ==; Date: Thu, 02 Jan 2025 08:14:11 +0200 Message-Id: <86h66hlp3g.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Wed, 1 Jan 2025 20:03:04 -0600) Subject: Re: bug#74311: Long startup time on windows (with simple fix) References: <86v7wtkj5c.fsf@gnu.org> <86ttcdkeuu.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74311-done Cc: vladimir.sironja@gmail.com, 74311-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Wed, 1 Jan 2025 20:03:04 -0600 > Cc: Vladimir Šironja , > 74311@debbugs.gnu.org > > Eli Zaretskii writes: > > >> From: Vladimir Šironja > >> Date: Mon, 11 Nov 2024 15:12:39 +0100 > >> Cc: 74311@debbugs.gnu.org > >> > >> sorry, didn't quite understand which bugs should be separated, please > >> advice again, > > > > Sorry, my misunderstanding, please ignore that part. > > > >> 1) regarding netlogon, I do not really have an option disconnecting from DC > > > > Canj you at least try it once, to see if that is the root cause? > > > >> Here the debugger session: > >> > >> (gdb) b w32.c:701 > >> Breakpoint 1 at 0x40031a8e0: file w32.c, line 701. > >> (gdb) run > >> Starting program: C:\Development\emacs-emacs-29.4\src\emacs.exe > >> [New Thread 20812.0x73b4] > >> [New Thread 20812.0x7bbc] > >> [New Thread 20812.0x60fc] > >> > >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > >> Sid=0x3e714b0, Name=0xbfe850 "└o\021", cbName=0xbfe32c, > >> DomainName=0xbfe330 "b", cbDomainName=0xbfe328, peUse=0xbfe314) at > >> w32.c:701 > >> 701 HMODULE hm_advapi32 = NULL; > >> (gdb) bt > >> #0 lookup_account_sid (lpSystemName=0x0, Sid=0x3e714b0, Name=0xbfe850 > >> "└o\021", cbName=0xbfe32c, DomainName=0xbfe330 "b", > >> cbDomainName=0xbfe328, peUse=0xbfe314) at w32.c:701 > >> #1 0x00007ff79378d364 in init_user_info () at w32.c:2314 > >> #2 0x00007ff79378f2fe in init_environment (argv=0x26015b0) at w32.c:3233 > >> #3 0x00007ff7935a93de in main (argc=1, argv=0x26015b0) at emacs.c:2120 > >> (gdb) continue > >> Continuing. > >> > >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > >> Sid=0x3e714a8, Name=0xbfe740 "XD┌ô\001", cbName=0xbfe320, > >> DomainName=0x0, cbDomainName=0xbfe328, peUse=0xbfe314) at w32.c:701 > >> 701 HMODULE hm_advapi32 = NULL; > >> (gdb) bt > >> #0 lookup_account_sid (lpSystemName=0x0, Sid=0x3e714a8, Name=0xbfe740 > >> "XD┌ô\001", cbName=0xbfe320, DomainName=0x0, cbDomainName=0xbfe328, > >> peUse=0xbfe314) at w32.c:701 > >> #1 0x00007ff79378d50c in init_user_info () at w32.c:2354 > >> #2 0x00007ff79378f2fe in init_environment (argv=0x26015b0) at w32.c:3233 > >> #3 0x00007ff7935a93de in main (argc=1, argv=0x26015b0) at emacs.c:2120 > >> (gdb) info locals > >> cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > >> 0x26065b0 "EDGE", peUse = SidTypeUser} > >> been_here_count = 2 > >> s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > >> hm_advapi32 = 0x7ff9e0d50000 > >> ret = 5 > >> (gdb) continue > >> Continuing. > >> [New Thread 20812.0x4594] > >> > >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > >> Sid=0x1242d4, Name=0xbfdb30 "\220\\q̨\177", cbName=0xbfdb2c, > >> DomainName=0xbfd720 "P3\022", cbDomainName=0xbfd71c, peUse=0xbfdc38) > >> at w32.c:701 > >> 701 HMODULE hm_advapi32 = NULL; > >> (gdb) bt > >> #0 lookup_account_sid (lpSystemName=0x0, Sid=0x1242d4, Name=0xbfdb30 > >> "\220\\q̨\177", cbName=0xbfdb2c, DomainName=0xbfd720 "P3\022", > >> cbDomainName=0xbfd71c, peUse=0xbfdc38) at w32.c:701 > >> #1 0x00007ff793792fa6 in get_name_and_id (psd=0x1242c0, id=0xbfeac0, > >> nm=0xbfeaf0 "ñ9Þ\003", what=1) at w32.c:5230 > >> #2 0x00007ff79379308b in get_file_owner_and_group (psd=0x1242c0, > >> st=0xbfeab0) at w32.c:5256 > >> #3 0x00007ff79379379f in stat_worker (path=0x7ff793da0043 > >> "Development\\emacs-emacs-29.4\\src\\", buf=0xbfeab0, > >> follow_symlinks=0) at w32.c:5504 > >> #4 0x00007ff793794217 in fstatat (fd=-3041965, name=0x3e7d408 > >> "c:/Development/emacs-emacs-29.4/src/", st=0xbfeab0, flags=4096) at > >> w32.c:5751 > >> #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=-3041965, > >> filename=0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > >> st=0xbfeab0, flags=4096) at sysdep.c:2338 > >> #6 0x00007ff793612ab9 in file_attributes (fd=-3041965, name=0x3e7d408 > >> "c:/Development/emacs-emacs-29.4/src/", dirname=0x0, > >> filename=0x3e839a4, id_format=0x0) at dired.c:1016 > >> #7 0x00007ff793612a1e in Ffile_attributes (filename=0x3e839a4, > >> id_format=0x0) at dired.c:962 > >> #8 0x00007ff7936810f6 in funcall_subr (subr=0x7ff793c824a0 > >> , numargs=1, args=0x4cbd070) at eval.c:3040 > >> #9 0x00007ff7936d99a3 in exec_byte_code (fun=0x44e227d, > >> args_template=513, nargs=2, args=0x4cbd200) at bytecode.c:809 > >> #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=0x43ee9e5, > >> args_template=0, nargs=0, args=0xbff420) at eval.c:3085 > >> #11 0x00007ff793681899 in funcall_lambda (fun=0x43ee9e5, nargs=0, > >> arg_vector=0xbff420) at eval.c:3157 > >> #12 0x00007ff793681676 in apply_lambda (fun=0x43ee9e5, args=0x0, > >> count=...) at eval.c:3107 > >> #13 0x00007ff79367fb3f in eval_sub (form=0x48a614b) at eval.c:2549 > >> #14 0x00007ff79367f0af in Feval (form=0x48a614b, lexical=0x0) at eval.c:2365 > >> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > >> #16 0x00007ff79367ce04 in internal_condition_case (bfun=0x7ff7935ae803 > >> , handlers=0x90, hfun=0x7ff7935adfad ) at > >> eval.c:1474 > >> #17 0x00007ff7935ae87c in top_level_1 (ignore=0x0) at keyboard.c:1150 > >> #18 0x00007ff79367c4ac in internal_catch (tag=0x103b0, > >> func=0x7ff7935ae82f , arg=0x0) at eval.c:1197 > >> #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > >> #20 0x0000000000000000 in ?? () > >> (gdb) info locals > >> cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > >> 0x26065b0 "EDGE", peUse = SidTypeUser} > >> been_here_count = 3 > >> s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > >> hm_advapi32 = 0x0 > >> ret = 0 > >> (gdb) continue > >> Continuing. > >> > >> Thread 1 hit Breakpoint 1, lookup_account_sid (lpSystemName=0x0, > >> Sid=0x1242f0, Name=0xbfdb30 "Vladimir.Sironja", cbName=0xbfdb2c, > >> DomainName=0xbfd720 "EDGE", cbDomainName=0xbfd71c, peUse=0xbfdc38) > >> at w32.c:701 > >> 701 HMODULE hm_advapi32 = NULL; > >> (gdb) bt > >> #0 lookup_account_sid (lpSystemName=0x0, Sid=0x1242f0, Name=0xbfdb30 > >> "Vladimir.Sironja", cbName=0xbfdb2c, DomainName=0xbfd720 "EDGE", > >> cbDomainName=0xbfd71c, peUse=0xbfdc38) at w32.c:701 > >> #1 0x00007ff793792fa6 in get_name_and_id (psd=0x1242c0, id=0xbfeac4, > >> nm=0xbfebf4 "", what=2) at w32.c:5230 > >> #2 0x00007ff7937930c2 in get_file_owner_and_group (psd=0x1242c0, > >> st=0xbfeab0) at w32.c:5258 > >> #3 0x00007ff79379379f in stat_worker (path=0x7ff793da0043 > >> "Development\\emacs-emacs-29.4\\src\\", buf=0xbfeab0, > >> follow_symlinks=0) at w32.c:5504 > >> #4 0x00007ff793794217 in fstatat (fd=-3041965, name=0x3e7d408 > >> "c:/Development/emacs-emacs-29.4/src/", st=0xbfeab0, flags=4096) at > >> w32.c:5751 > >> #5 0x00007ff7935d7b79 in emacs_fstatat (dirfd=-3041965, > >> filename=0x3e7d408 "c:/Development/emacs-emacs-29.4/src/", > >> st=0xbfeab0, flags=4096) at sysdep.c:2338 > >> #6 0x00007ff793612ab9 in file_attributes (fd=-3041965, name=0x3e7d408 > >> "c:/Development/emacs-emacs-29.4/src/", dirname=0x0, > >> filename=0x3e839a4, id_format=0x0) at dired.c:1016 > >> #7 0x00007ff793612a1e in Ffile_attributes (filename=0x3e839a4, > >> id_format=0x0) at dired.c:962 > >> #8 0x00007ff7936810f6 in funcall_subr (subr=0x7ff793c824a0 > >> , numargs=1, args=0x4cbd070) at eval.c:3040 > >> #9 0x00007ff7936d99a3 in exec_byte_code (fun=0x44e227d, > >> args_template=513, nargs=2, args=0x4cbd200) at bytecode.c:809 > >> #10 0x00007ff7936814f2 in fetch_and_exec_byte_code (fun=0x43ee9e5, > >> args_template=0, nargs=0, args=0xbff420) at eval.c:3085 > >> #11 0x00007ff793681899 in funcall_lambda (fun=0x43ee9e5, nargs=0, > >> arg_vector=0xbff420) at eval.c:3157 > >> #12 0x00007ff793681676 in apply_lambda (fun=0x43ee9e5, args=0x0, > >> count=...) at eval.c:3107 > >> #13 0x00007ff79367fb3f in eval_sub (form=0x48a614b) at eval.c:2549 > >> #14 0x00007ff79367f0af in Feval (form=0x48a614b, lexical=0x0) at eval.c:2365 > >> #15 0x00007ff7935ae82a in top_level_2 () at keyboard.c:1142 > >> #16 0x00007ff79367ce04 in internal_condition_case (bfun=0x7ff7935ae803 > >> , handlers=0x90, hfun=0x7ff7935adfad ) at > >> eval.c:1474 > >> #17 0x00007ff7935ae87c in top_level_1 (ignore=0x0) at keyboard.c:1150 > >> #18 0x00007ff79367c4ac in internal_catch (tag=0x103b0, > >> func=0x7ff7935ae82f , arg=0x0) at eval.c:1197 > >> #19 0x00007ff7935ae6d2 in command_loop () at keyboard.c:1110 > >> #20 0x0000000000000000 in ?? () > >> (gdb) info locals > >> cache = {ret = 1, Name = 0x2606560 "Vladimir.Sironja", DomainName = > >> 0x26065b0 "EDGE", peUse = SidTypeUser} > >> been_here_count = 4 > >> s_pfn_Lookup_Account_Sid = 0x7ff9e0d9bc20 > >> hm_advapi32 = 0x0 > >> ret = 0 > >> (gdb) continue > >> Continuing. > >> [New Thread 20812.0x4f7c] > >> [New Thread 20812.0x6d38] > >> [New Thread 20812.0x4a54] > >> > >> here emacs comes up. > >> > >> So for some reason been_here_count = 4. > > > > This tells me: > > > > . the first 2 calls are from init_user_info, where we obtain and > > record the user SID and the Group SID of your user > > . the next 2 calls are from file-attributes, where Emacs for some > > reason needed to obtain the owner and owner's group of the > > directory "c:/Development/emacs-emacs-29.4/src" > > > > These are different calls for different purposes: they obtain both the > > user and group SID (which are different SID values), and there's no > > guarantee that the directory "c:/Development/emacs-emacs-29.4/src" is > > necessarily owned by your user. > > > > So I don't see how caching could help here, and still produce the > > correct results. > > > > You could avoid the second pair of calls (and many similar calls in > > other cases where Emacs calls file-attributes) if you set the variable > > w32-get-true-file-attributes to the nil value. Maybe this makes > > startup faster in your case. > > Does that mean that we should close this as wontfix? Yes, done. From unknown Sun Sep 21 08:31:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 30 Jan 2025 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator