ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "alanwu (Alan Wu) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "alanwu (Alan Wu)" <noreply@ruby-lang.org>
Subject: [ruby-core:120763] [Ruby master Bug#21021] "try to mark T_NONE object" with 3.4.1
Date: Thu, 23 Jan 2025 09:20:40 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-111628.20250123092040.12344@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-21021.20250109154330.12344@ruby-lang.org>

Issue #21021 has been updated by alanwu (Alan Wu).


The following patch combined with the crash output should narrow the culprit down to a couple entries in the stack trace. It prints an index of the "Ruby level backtrace information" section, but it relies on a heuristic so could be off by a small amount.
You can then try putting `GC.stress = true/false` around a region of code mentioned in the stack trace to further narrow things down. It should up the crash rate, and if it does, that shows the bug is somewhere in the stress region. 

```patch
diff --git a/gc.c b/gc.c
index e4b564a38d..1983501231 100644
--- a/gc.c
+++ b/gc.c
@@ -2320,7 +2320,14 @@ rb_gc_mark_values(long n, const VALUE *values)
 void
 rb_gc_mark_vm_stack_values(long n, const VALUE *values)
 {
+    int frame_flag_count = 0;
     for (long i = 0; i < n; i++) {
+        if (VM_FRAME_MAGIC_METHOD <= values[i] && values[i] < 0x80000000ul) { // see VM_FRAME_MAGIC_MASK
+            frame_flag_count++;
+        }
+        if (RB_TYPE_P(values[i], T_NONE)) {
+            rb_bug("T_NONE on stack. Seems to be from %dth frame", frame_flag_count);
+        }
         gc_mark_and_pin_internal(values[i]);
     }
 }

```

----------------------------------------
Bug #21021: "try to mark T_NONE object" with 3.4.1
https://bugs.ruby-lang.org/issues/21021#change-111628

* Author: Benoit_Tigeot (Benoit Tigeot)
* Status: Open
* ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [x86_64-linux]                                                                                                                                  │
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Hello

We upgraded to 3.4.1 yesterday but we are seeing crash since then.

```
/bundle/ruby/3.4.0/gems/activejob-7.2.2.1/lib/active_job/enqueuing.rb:93: [BUG] try to mark T_NONE object
```

I saw the other issue related to ffi gem https://bugs.ruby-lang.org/issues/20694

But in our case the `C level backtrace information` looks different.

https://gist.github.com/benoittgt/13507c2000281aa7740bc782adab68c5


We migrated this part of the code to parallel->concurrent-ruby and we do not see the error yet again but I am a little bit worried we could see the issue again. 



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

  parent reply	other threads:[~2025-01-23  9:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 15:43 [ruby-core:120580] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-09 16:05 ` [ruby-core:120582] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-09 17:10 ` [ruby-core:120586] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-09 20:26 ` [ruby-core:120590] " tenderlovemaking (Aaron Patterson) via ruby-core
2025-01-09 22:33 ` [ruby-core:120591] " alanwu (Alan Wu) via ruby-core
2025-01-10  8:52 ` [ruby-core:120595] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-10 11:40 ` [ruby-core:120599] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-15 16:41 ` [ruby-core:120699] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-15 17:30 ` [ruby-core:120700] " tenderlovemaking (Aaron Patterson) via ruby-core
2025-01-15 19:58 ` [ruby-core:120704] " alanwu (Alan Wu) via ruby-core
2025-01-15 22:38 ` [ruby-core:120709] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-16 16:37 ` [ruby-core:120718] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-16 19:52 ` [ruby-core:120719] " tenderlovemaking (Aaron Patterson) via ruby-core
2025-01-17 13:20 ` [ruby-core:120727] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-17 17:22 ` [ruby-core:120729] " tenderlovemaking (Aaron Patterson) via ruby-core
2025-01-18 11:45 ` [ruby-core:120734] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-23  9:20 ` alanwu (Alan Wu) via ruby-core [this message]
2025-01-23 17:29 ` [ruby-core:120768] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-23 18:05 ` [ruby-core:120769] " byroot (Jean Boussier) via ruby-core
2025-01-23 19:11 ` [ruby-core:120771] " alanwu (Alan Wu) via ruby-core
2025-01-24 12:11 ` [ruby-core:120781] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-24 12:17 ` [ruby-core:120782] " byroot (Jean Boussier) via ruby-core
2025-01-24 13:11 ` [ruby-core:120783] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-24 16:39 ` [ruby-core:120786] " travisbell (Travis Bell) via ruby-core
2025-01-29  0:57 ` [ruby-core:120815] " alanwu (Alan Wu) via ruby-core
2025-01-29 15:49 ` [ruby-core:120832] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-01-30  7:49 ` [ruby-core:120839] " Benoit_Tigeot (Benoit Tigeot) via ruby-core
2025-02-14  1:45 ` [ruby-core:120999] " k0kubun (Takashi Kokubun) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-111628.20250123092040.12344@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).