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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham 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 6CF4C1F731 for ; Wed, 31 Jul 2019 10:52:00 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 90ACF120B3D; Wed, 31 Jul 2019 19:51:51 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 961B3120AFA for ; Wed, 31 Jul 2019 19:51:48 +0900 (JST) Received: by filter0178p3mdw1.sendgrid.net with SMTP id filter0178p3mdw1-8162-5D4172C6-C 2019-07-31 10:51:50.17345577 +0000 UTC m=+401272.276877280 Received: from herokuapp.com (unknown [54.152.150.139]) by ismtpd0006p1iad2.sendgrid.net (SG) with ESMTP id Yfgcf_sNT1GdAkD_7VNsfA for ; Wed, 31 Jul 2019 10:51:50.052 +0000 (UTC) Date: Wed, 31 Jul 2019 10:51:50 +0000 (UTC) From: deivid.rodriguez@riseup.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 69578 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15912 X-Redmine-Issue-Author: deivid X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: deivid 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?klzXTY0v3jOvaMSihdVenmzxCeXPrK4t1AV7GwiE8TitZY2bWCk9H7EcZAwoFi?= =?us-ascii?Q?F+0CMcDGUg8oSVSPs+rcy3FVvGxkWizO5rGvVkS?= =?us-ascii?Q?NWWhuEKCHQIxOxiVb1QuuXtQLSABJmn82GdcvVo?= =?us-ascii?Q?PX69HjfJCcIy1ZVfBc2WQVp6eNV4FYcqh3dJIYC?= =?us-ascii?Q?48W4Ior7=2F7E1yc57nmD+0+KOxq4wCcvsuyQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 94071 Subject: [ruby-core:94071] [Ruby master Feature#15912] Allow some reentrancy during TracePoint events 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15912 has been updated by deivid (David Rodr=EDguez). Hi Koichi! Thanks for answering. So, you mean to allow the reentrancy (TracePoint events being triggered fro= m inside TracePoint handlers) if the TracePoint API user requests so? I gue= ss that would work, I could call `tp.reopen {}` before giving a prompt to t= he byebug user, so that zeitwerk events will trigger. I wonder though whether it's better that this _just works_ when it could wo= rk, and it ignores events when they would cause an infinite loop. I think m= y suggestion of keeping a stack of events being handled would allow that an= d would require no additions to the API. ---------------------------------------- Feature #15912: Allow some reentrancy during TracePoint events https://bugs.ruby-lang.org/issues/15912#change-80301 * Author: deivid (David Rodr=EDguez) * Status: Assigned * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: = ---------------------------------------- I got a report in byebug about byebug being incompatible with zeitwerk. Thi= s one: https://github.com/deivid-rodriguez/byebug/issues/564. This is a pro= blem because zeitwerk is the default Rails code loader, and byebug is the d= efault Rails debugger. Both of these tools rely on the TracePoint API: * Byebug uses a bunch of TracePoint events to stop execution at certain poi= nts in your program. * Zeitwek uses `:class` events to be able to resolve some circular edge cas= es. I investigated the problem and I think the issue is that while stopped at t= he byebug prompt, we're actually in the middle of processing a TracePoint e= vent. That means that further TracePoint events triggered at the byebug's p= rompt will be ignored, because otherwise we could get into an infinite loop= where the handling of events would trigger more events that trigger themse= lves the execution of handlers again. I understand why the TracePoint API does this, but if we could allow some l= evel of reentrancy here, we could probably make these tools play nice toget= her. I figure if we kept a stack of TracePoint event handlers being run, an= d check that the current event type is not already in the stack, we would a= llow :class events to be triggered from :line events, and I think that woul= d allow Zeitwerk to work within byebug. What do you think about this, @ko1? -- = https://bugs.ruby-lang.org/ Unsubscribe: