[#119670] [Ruby master Feature#20859] Make Base64 to core class — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #20859 has been reported by hsbt (Hiroshi SHIBATA).

8 messages 2024/11/01

[#119683] [Ruby master Feature#20861] Add an environment variable for tuning the default thread quantum — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #20861 has been reported by tenderlovemaking (Aaron Patterson).

24 messages 2024/11/01

[#119724] [Ruby master Bug#20863] `zlib.c` calls `rb_str_set_len` and `rb_str_modify_expand`(and others) without holding the GVL. — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

Issue #20863 has been reported by ioquatix (Samuel Williams).

8 messages 2024/11/05

[#119726] [Ruby master Feature#20864] Support `error:` keyword to `Kernel#warn` — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

Issue #20864 has been reported by ioquatix (Samuel Williams).

14 messages 2024/11/05

[#119741] [Ruby master Bug#20869] IO buffer handling is inconsistent when seeking — "javanthropus (Jeremy Bopp) via ruby-core" <ruby-core@...>

Issue #20869 has been reported by javanthropus (Jeremy Bopp).

13 messages 2024/11/05

[#119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array — "sanderd17 (Sander Deryckere) via ruby-core" <ruby-core@...>

Issue #20871 has been reported by sanderd17 (Sander Deryckere).

13 messages 2024/11/05

[#119769] [Ruby master Feature#20875] Atomic initialization for Ractor local storage — "ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>

Issue #20875 has been reported by ko1 (Koichi Sasada).

12 messages 2024/11/06

[#119801] [Ruby master Feature#20878] A new C API to create a String by adopting a pointer: `rb_enc_str_adopt(const char *ptr, long len, long capa, rb_encoding *enc)` — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

Issue #20878 has been reported by byroot (Jean Boussier).

32 messages 2024/11/07

[#119852] [Ruby master Feature#20882] Provide Boolean(...) — "getajobmike (Mike Perham) via ruby-core" <ruby-core@...>

Issue #20882 has been reported by getajobmike (Mike Perham).

12 messages 2024/11/08

[#119881] [Ruby master Feature#20884] reserve "Ruby" toplevel module for Ruby language — "Dan0042 (Daniel DeLorme) via ruby-core" <ruby-core@...>

Issue #20884 has been reported by Dan0042 (Daniel DeLorme).

8 messages 2024/11/12

[#119897] [Ruby master Bug#20890] MacOS 15.1, Macbook pro 2024 m4, YJIT: Kernel Panic on network access, works w/o YJIT — "markus_d (Markus Doits) via ruby-core" <ruby-core@...>

Issue #20890 has been reported by markus_d (Markus Doits).

24 messages 2024/11/12

[#119988] [Ruby master Bug#20904] 3.4.0-preview2: Building miniruby.exe fails for mswin32 — "jun66j5 (Jun Omae) via ruby-core" <ruby-core@...>

Issue #20904 has been reported by jun66j5 (Jun Omae).

11 messages 2024/11/22

[#120002] [Ruby master Bug#20908] Ruby extension builds fail with GCC 15 which defaults to -std=gnu23 — "thesamesam (Sam James) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwOTA4IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHRoZXNhbWVzYW0gKFNhbSBKYW1lcyku

7 messages 2024/11/25

[#120016] [Ruby master Feature#20912] Move warning when redefining object_id to __id__ — "jhawthorn (John Hawthorn) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwOTEyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGpoYXd0aG9ybiAoSm9obiBIYXd0aG9y

11 messages 2024/11/27

[#120027] [Ruby master Misc#20913] Proposal: Adding Jeremy Evans and Burdette Lamar to www.ruby-lang.org's English Editorial Team — "st0012 (Stan Lo) via ruby-core" <ruby-core@...>

Issue #20913 has been reported by st0012 (Stan Lo).

6 messages 2024/11/27

[#120043] [Ruby master Bug#20919] IO#seek does not clear the character buffer in some cases while transcoding — "javanthropus (Jeremy Bopp) via ruby-core" <ruby-core@...>

Issue #20919 has been reported by javanthropus (Jeremy Bopp).

7 messages 2024/11/28

[ruby-core:119714] [Ruby master Bug#20853] Hash key retrieval after Process.warmup

From: "k0kubun (Takashi Kokubun) via ruby-core" <ruby-core@...>
Date: 2024-11-04 22:43:54 UTC
List: ruby-core #119714
Issue #20853 has been updated by k0kubun (Takashi Kokubun).

Backport changed from 3.1: WONTFIX, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: WONTFIX, 3.2: REQUIRED, 3.3: DONE

ruby_3_3 commit:6db39f4677ff50aacfe54bd9dda052c09e1c6ab0 merged revision(s) commit:29c480dd6fca993590c82078ba797e2c4e876ac7.

----------------------------------------
Bug #20853: Hash key retrieval after Process.warmup
https://bugs.ruby-lang.org/issues/20853#change-110378

* Author: keelerm84 (Matthew Keeler)
* Status: Closed
* ruby -v: ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
* Backport: 3.1: WONTFIX, 3.2: REQUIRED, 3.3: DONE
----------------------------------------
This was first reported as an issue against the [LaunchDarkly SDK](https://github.com/launchdarkly/ruby-server-sdk/issues/282) and [Sidekiq SDKs](https://github.com/sidekiq/sidekiq/issues/6279) as an issue in Ruby 3.3.1. I can still in Ruby 3.3.5.

**Overview of behavior**
The LaunchDarkly SDK maintains a hash of feature and segment information. This hash is indexed by 2 keys which are themselves hashes. They are defined as:

```
  FEATURES = {
    namespace: "features",
    priority: 1,
    get_dependency_keys: lambda { |flag| (flag[:prerequisites] || []).map { |p| p[:key] } },
  }.freeze

  SEGMENTS = {
    namespace: "segments",
    priority: 0,
  }.freeze
```

When running the attached script, we often see an error indicating that the flag is not found. If you comment out the `Process.warmup` line, this error will go away.

The `require 'active_support/all'` directive is not strictly necessary. Including it causes the failure to more frequently occur, presumably due to the increase work in the warmup phase.

**Hash key and access**
When debugging the LaunchDarkly code, I noticed some odd behavior. Even though the hash seems populated, the FEATURES key could not index into it correctly.

Below is a bit of code, modified from the SDK, to show how we are trying to interact with the hash. The puts are added to clarify the issue.

```ruby
    def get(kind, key)
      @lock.with_read_lock do

        @items.keys.each do |k|
          puts "##### Does #{kind[:namespace]} match the key #{k}? #{k == kind} #{k.eql?(kind)} #{k.hash == kind.hash}"
        end
        puts "###### Does @items include it? #{@items.include?(kind)}"

        coll = @items[kind]
        f = coll.nil? ? nil : coll[key.to_sym]
        (f.nil? || f[:deleted]) ? nil : f
      end
    end
```

*Running without Process.warmup*

If we run the attached script without the `Process.warmup` call, we will see that the keys align with the FEATURES key we provided. Additionally, the hash does see that the key exists, resulting in an evaluation result of true at the end.

That output follows.


```shell
##### Does features match the key {:namespace=>"segments", :priority=>0}? false false false
##### Does features match the key {:namespace=>"features", :priority=>1, :get_dependency_keys=>#<Proc:0x00007ee6174f9738 /home/mkeeler/code/launchdarkly/ruby-server-sdk.git/main/lib/ldclient-rb/in_memory_store.rb:17 (lambda)>}? true true true
###### Does @items include it? true
true
```

*Running with Process.warmup*

If you enable the `Process.warmup` option, and run the script a few times, you will see output similar to the following.

Note that while the keys are `==`, `eql?`, and their `.hash` values are equal, the hash does not see that the FEATURES key exists.


```shell
##### Does features match the key {:namespace=>"segments", :priority=>0}? false false false
##### Does features match the key {:namespace=>"features", :priority=>1, :get_dependency_keys=>#<Proc:0x0000774f1cbfd730 /home/mkeeler/code/launchdarkly/ruby-server-sdk.git/main/lib/ldclient-rb/in_memory_store.rb:17 (lambda)>}? true true true
###### Does @items include it? false
I, [2024-10-30T14:34:33.842145 #974568]  INFO -- : [LDClient] Unknown feature flag "sample-feature". Returning default value
false
```


**Workarounds**

We have worked around this issue by replacing these keys with classes. You can refer to the [PR here](https://github.com/launchdarkly/ruby-server-sdk/pull/301/files) for those details.

You can also resolve this by triggering a `rehash` on the hash after the `Process.warmup` has run.

---Files--------------------------------
main.rb (630 Bytes)
Gemfile (96 Bytes)


-- 
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/


In This Thread