ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
@ 2024-04-24 13:41 Earlopain (A S) via ruby-core
  2024-04-24 14:07 ` [ruby-core:117685] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Earlopain (A S) via ruby-core @ 2024-04-24 13:41 UTC (permalink / raw)
  To: ruby-core; +Cc: Earlopain (A S)

Issue #20452 has been reported by Earlopain (A S).

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452

* Author: Earlopain (A S)
* Status: Open
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117685] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
@ 2024-04-24 14:07 ` nobu (Nobuyoshi Nakada) via ruby-core
  2024-04-24 14:24 ` [ruby-core:117686] " Earlopain (A S) via ruby-core
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-04-24 14:07 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20452 has been updated by nobu (Nobuyoshi Nakada).


Does `configure` with `ac_cv_func_pthread_get_stackaddr_np=no` change something?

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108094

* Author: Earlopain (A S)
* Status: Open
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117686] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
  2024-04-24 14:07 ` [ruby-core:117685] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-04-24 14:24 ` Earlopain (A S) via ruby-core
  2024-04-24 22:16 ` [ruby-core:117692] " hsbt (Hiroshi SHIBATA) via ruby-core
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Earlopain (A S) via ruby-core @ 2024-04-24 14:24 UTC (permalink / raw)
  To: ruby-core; +Cc: Earlopain (A S)

Issue #20452 has been updated by Earlopain (A S).


nobu (Nobuyoshi Nakada) wrote in #note-1:
> Does `configure` with `ac_cv_func_pthread_get_stackaddr_np=no` change something?

Thank you for your reply. I modified `export ac_cv_func_isnan=yes ac_cv_func_isinf=yes` to `export ac_cv_func_pthread_get_stackaddr_np=no ac_cv_func_isnan=yes ac_cv_func_isinf=yes` and rebuild but the StackError occured at basically the same depth.

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108095

* Author: Earlopain (A S)
* Status: Open
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117692] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
  2024-04-24 14:07 ` [ruby-core:117685] " nobu (Nobuyoshi Nakada) via ruby-core
  2024-04-24 14:24 ` [ruby-core:117686] " Earlopain (A S) via ruby-core
@ 2024-04-24 22:16 ` hsbt (Hiroshi SHIBATA) via ruby-core
  2024-04-25 11:38 ` [ruby-core:117702] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hsbt (Hiroshi SHIBATA) via ruby-core @ 2024-04-24 22:16 UTC (permalink / raw)
  To: ruby-core; +Cc: hsbt (Hiroshi SHIBATA)

Issue #20452 has been updated by hsbt (Hiroshi SHIBATA).

Tags set to musl, alpine
Status changed from Open to Feedback

Unfortunately, there is no active maintainer for musl or alpine platform.

I tagged them to [musl](https://bugs.ruby-lang.org/projects/ruby-master/issues?fields%5B%5D=issue_tags&operators%5Bissue_tags%5D=%3D&set_filter=1&values%5Bissue_tags%5D%5B%5D=musl). We welcome patch for them.

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108101

* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117702] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
                   ` (2 preceding siblings ...)
  2024-04-24 22:16 ` [ruby-core:117692] " hsbt (Hiroshi SHIBATA) via ruby-core
@ 2024-04-25 11:38 ` nobu (Nobuyoshi Nakada) via ruby-core
  2024-04-25 12:05 ` [ruby-core:117703] " nobu (Nobuyoshi Nakada) via ruby-core
  2024-04-25 14:50 ` [ruby-core:117707] " Earlopain (A S) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-04-25 11:38 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20452 has been updated by nobu (Nobuyoshi Nakada).


`make DEFS=-DMAINSTACKADDR_AVAILABLE=0 thread.o` seems working.

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108112

* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117703] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
                   ` (3 preceding siblings ...)
  2024-04-25 11:38 ` [ruby-core:117702] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-04-25 12:05 ` nobu (Nobuyoshi Nakada) via ruby-core
  2024-04-25 14:50 ` [ruby-core:117707] " Earlopain (A S) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-04-25 12:05 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #20452 has been updated by nobu (Nobuyoshi Nakada).


Does this help you?
https://github.com/nobu/ruby/tree/mainstackaddr

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108113

* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:117707] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
  2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
                   ` (4 preceding siblings ...)
  2024-04-25 12:05 ` [ruby-core:117703] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-04-25 14:50 ` Earlopain (A S) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: Earlopain (A S) via ruby-core @ 2024-04-25 14:50 UTC (permalink / raw)
  To: ruby-core; +Cc: Earlopain (A S)

Issue #20452 has been updated by Earlopain (A S).


nobu (Nobuyoshi Nakada) wrote in #note-5:
> Does this help you?
> https://github.com/nobu/ruby/tree/mainstackaddr

Thank you. I tried it out with your patch but something is missing still. Building with `make DEFS=-DMAINSTACKADDR_AVAILABLE=0` from your comment above works wonderfully though.

I believe `HAVE_PTHREAD_GETATTR_NP` may be defined? In `configure.log` I see `HAVE_PTHREAD_GETATTR_NP=1` a few times. https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getattr_np.c

----------------------------------------
Bug #20452: Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception
https://bugs.ruby-lang.org/issues/20452#change-108118

* Author: Earlopain (A S)
* Status: Feedback
* ruby -v: 3.3.1
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
This is a redo of https://bugs.ruby-lang.org/issues/14387, reported against a non-eol version. The same issue still applies on recent rubies, though I personally only have tested 3.3 and 3.2:

```rb
n = 100000
res = {}
1.upto(n).to_a.inject(res) do |r, i|
  r[i] = {}
end

def f(x)
  x.each_value { |v| f(v) }
end

f(res)
```

The patch from https://bugs.ruby-lang.org/issues/14387#note-13 still works, though as per https://bugs.ruby-lang.org/issues/14387#note-16 it can't be accepted as is.

With the patch applied:
```
(irb):8:in `block in f': stack level too deep (SystemStackError)
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
         ... 11549 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

Without the patch:

```
(irb):8:in `each_value': stack level too deep (SystemStackError)
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
        from (irb):8:in `each_value'
        from (irb):8:in `f'
        from (irb):8:in `block in f'
         ... 286 levels...
        from /usr/local/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /usr/local/bin/irb:25:in `load'
        from /usr/local/bin/irb:25:in `<main>'
```

To reproduce, I have removed lines 102-105 from https://github.com/docker-library/ruby/blob/f5753434bb23041dd9913bb7b650e7be735e03c0/3.3/alpine3.19/Dockerfile. Check out the previous ticket for more information, there are a few conversations about possible solutions.



-- 
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/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-25 14:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 13:41 [ruby-core:117684] [Ruby master Bug#20452] Ruby 3.3 on Alpine Linux results in a relatively shallow SystemStackError exception Earlopain (A S) via ruby-core
2024-04-24 14:07 ` [ruby-core:117685] " nobu (Nobuyoshi Nakada) via ruby-core
2024-04-24 14:24 ` [ruby-core:117686] " Earlopain (A S) via ruby-core
2024-04-24 22:16 ` [ruby-core:117692] " hsbt (Hiroshi SHIBATA) via ruby-core
2024-04-25 11:38 ` [ruby-core:117702] " nobu (Nobuyoshi Nakada) via ruby-core
2024-04-25 12:05 ` [ruby-core:117703] " nobu (Nobuyoshi Nakada) via ruby-core
2024-04-25 14:50 ` [ruby-core:117707] " Earlopain (A S) via ruby-core

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 read-only IMAP folder(s) and NNTP newsgroup(s).