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=-2.8 required=3.0 tests=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_PASS 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 1715F1F97E for ; Fri, 23 Nov 2018 18:02:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D2B2D120D7C; Sat, 24 Nov 2018 03:02:23 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 8F04D120C5D for ; Sat, 24 Nov 2018 03:02:21 +0900 (JST) Received: by filter0056p3mdw1.sendgrid.net with SMTP id filter0056p3mdw1-2847-5BF840A8-25 2018-11-23 18:02:16.222460296 +0000 UTC m=+683512.870913586 Received: from herokuapp.com (ec2-54-147-157-116.compute-1.amazonaws.com [54.147.157.116]) by ismtpd0029p1mdw1.sendgrid.net (SG) with ESMTP id F9BqA0WCQY-lK-rP8ObsuQ Fri, 23 Nov 2018 18:02:16.125 +0000 (UTC) Date: Fri, 23 Nov 2018 18:02:17 +0000 (UTC) From: stanhu@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65408 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15325 X-Redmine-Issue-Author: stanhu X-Redmine-Sender: stanhu 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7dTVMDtzc5hGn+3F20ZGwffv5KbvxouMXCTp cVbA9XVPuifgn3ta2YONtSWHsIXcDkgdMft+6/FmOuhPZ0TGIkb1Jh96Udbuneum4gaOatUNUYHx92 /o0ZpAhktNSmJTMk7F9nae5TbNZdwvdwuvjf X-ML-Name: ruby-core X-Mail-Count: 90009 Subject: [ruby-core:90009] [Ruby trunk Bug#15325] Ruby 2.5.3 seg fault after find block returns 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 #15325 has been updated by stanhu (Stan Hu). Ok, I think this bug is caused by https://bugs.ruby-lang.org/issues/15105. We were using the binding_of_caller gem, which calls `rb_debug_inspector_open`. The seg fault doesn't happen if we omit that call. ---------------------------------------- Bug #15325: Ruby 2.5.3 seg fault after find block returns https://bugs.ruby-lang.org/issues/15325#change-75113 * Author: stanhu (Stan Hu) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin15] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- In https://gitlab.com/gitlab-org/gitlab-ce/blob/233af8f1731734aaad7e5055af39f26c16608649/app/services/ci/register_job_service.rb#L48, we see a repeatable seg fault on both MacOS and Ubuntu with Rails 5.0.7 in a development environment. The seg fault appears to occur after the `find` returns: ~~~ builds.find do |build| next unless runner.can_pick?(build) begin # In case when 2 runners try to assign the same build, second runner will be declined # with StateMachines::InvalidTransition or StaleObjectError when doing run! or save method. if assign_runner!(build, params) register_success(build) return Result.new(build, true) # <--- SEG FAULT HAPPENS AFTER HERE end rescue StateMachines::InvalidTransition, ActiveRecord::StaleObjectError ~~~ The segfault shows some bad memory access: ~~~ Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff5d0e8b86 __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff5d19ec50 pthread_kill + 285 2 libsystem_c.dylib 0x00007fff5d0521c9 abort + 127 3 ruby 0x000000010f5ec6a9 die + 9 4 ruby 0x000000010f5ec908 rb_bug_context + 600 5 ruby 0x000000010f6db7a1 sigsegv + 81 6 libsystem_platform.dylib 0x00007fff5d193b3d _sigtramp + 29 7 ??? 000000000000000000 0 + 0 8 ruby 0x000000010f75461e vm_exec + 142 9 ruby 0x000000010f761f25 invoke_block_from_c_bh + 405 10 ruby 0x000000010f74f719 rb_yield + 153 11 ruby 0x000000010f5e33b9 find_i + 41 12 ruby 0x000000010f7620ca invoke_block_from_c_bh + 826 13 ruby 0x000000010f74f719 rb_yield + 153 14 ruby 0x000000010f57cce9 rb_ary_each + 41 15 ruby 0x000000010f759f51 vm_call_cfunc + 305 16 ruby 0x000000010f742a0d vm_exec_core + 9149 17 ruby 0x000000010f75461e vm_exec + 142 18 ruby 0x000000010f761d41 rb_call0 + 161 19 ruby 0x000000010f74fe54 iterate_method + 52 20 ruby 0x000000010f74fd9b rb_iterate0 + 347 21 ruby 0x000000010f74fe1a rb_block_call + 74 22 ruby 0x000000010f5e0518 enum_find + 104 23 ruby 0x000000010f759f51 vm_call_cfunc + 305 24 ruby 0x000000010f7436bd vm_exec_core + 12397 ~~~ We do NOT see the problem after downgrading to 2.4.5. ---Files-------------------------------- ruby_2018-11-20-132027_jet.crash (66.1 KB) ruby-2.5.3-segfault.txt (774 KB) -- https://bugs.ruby-lang.org/