From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id ADD1A1F9FC for ; Sat, 20 Mar 2021 04:20:03 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 5A1B41209F6; Sat, 20 Mar 2021 13:19:04 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 64F631209E2 for ; Sat, 20 Mar 2021 13:19:02 +0900 (JST) Received: by filterdrecv-p3iad2-7b664dbcb7-8bp47 with SMTP id filterdrecv-p3iad2-7b664dbcb7-8bp47-19-605577ED-1B 2021-03-20 04:19:57.588472723 +0000 UTC m=+119654.886159779 Received: from herokuapp.com (unknown) by geopod-ismtpd-2-0 (SG) with ESMTP id OSeTBIOUT5-uB_eUR0l93A for ; Sat, 20 Mar 2021 04:19:57.536 +0000 (UTC) Date: Sat, 20 Mar 2021 04:19:57 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 78974 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 15852 X-Redmine-Issue-Author: test35965@gmail.com X-Redmine-Sender: nagachika X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FDej10w0cDysBGhraSwOs?= =?us-ascii?Q?Ln7xVC=2FSNcux4gjYuaqF=2FSmUIItPk+mKMDQHIRO?= =?us-ascii?Q?xC3=2FSdxifkM1Ju3GAZZkQvBxQ=2F=2Fqqil9afjQg8e?= =?us-ascii?Q?zT0u9FtWUb9iuqI49M4H3Rny3CDtexIut7mfn3o?= =?us-ascii?Q?1TAcbsmaxbeyXUbJ1eBhNrfIo1Zc08lUQMRygy2?= =?us-ascii?Q?MGYzicr91hlU9EePM=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 102939 Subject: [ruby-core:102939] [Ruby master Bug#15852] APPLICATION_VERIFIER_LOCKS_LOCK_IN_FREED_HEAP on exiting ruby X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15852 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE to 2.6: REQUIRED, 2.7: DONE, 3.0: DONE ruby_2_7 30942fc4d89a04792e9eba7d3c4e5009c54e81da merged revision(s) 2a83650b0fd25719fb6c03bfec7bd895734d3ceb. ---------------------------------------- Bug #15852: APPLICATION_VERIFIER_LOCKS_LOCK_IN_FREED_HEAP on exiting ruby https://bugs.ruby-lang.org/issues/15852#change-91005 * Author: test35965@gmail.com (Alexander Riccio) * Status: Closed * Priority: Normal * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32] * Backport: 2.6: REQUIRED, 2.7: DONE, 3.0: DONE ---------------------------------------- Ruby appears to be freeing some critical section in ruby_vm_destruct before deleting the critical section. Critical Section objects must be deleted with DeleteCriticalSection (https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-deletecriticalsection) before freeing the owning memory. I can't tell exactly what critical section is being freed - I'm new to ruby, don't know how the VM works, and haven't built it locally - so I can't help you guys there yet. The clean stack trace is: ``` 0:000> kc # Call Site 00 vrfcore!VerifierStopMessageEx 01 vfbasics!AVrfpFreeMemLockChecks 02 vfbasics!AVrfpFreeMemNotify 03 vfbasics!AVrfpRtlFreeHeap 04 msvcrt!free 05 vfbasics!AVrfp_free 06 x64_msvcrt_ruby260!ruby_xfree 07 x64_msvcrt_ruby260!ruby_vm_destruct 08 x64_msvcrt_ruby260!ruby_cleanup 09 x64_msvcrt_ruby260!ruby_run_node 0a image00000000_00400000 0b image00000000_00400000 0c image00000000_00400000 0d KERNEL32!BaseThreadInitThunk 0e ntdll!RtlUserThreadStart ``` I'm running `C:\Ruby26-x64\bin\ruby.exe -x "C:\Ruby26-x64\bin\irb.cmd" `, with Application Verifier lock verification enabled. Application Verifier is the Windows SDK dynamic analysis tool, and it can be enabled by anybody who's installed the SDK. Add ruby.exe to the list of applications in Application Verifier and then run irb from inside windbg. Leak analysis should be enabled by default. I've attached the full debug log in Windbg. ---Files-------------------------------- ruby_freeing_active_critsec.TXT (17.2 KB) -- https://bugs.ruby-lang.org/