Skip to content

encoding.c: check for autoload before checking index #13970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

casperisfine
Copy link
Contributor

Otherwise we may be checking the index while the encoding is being autoloaded by another ractor.

I suspect this may be the cause behind:

  1) Failure:
TestEncoding#test_ractor_lazy_load_encoding_concurrently [/tmp/ruby/src/trunk/test/ruby/test_encoding.rb:141]:
assert_separately failed with error message
pid 315058 exit 1
| #<Thread:0x0000721c69ba0cc8 run> terminated with exception (report_on_exception is true):
| -:20:in 'String#force_encoding': wrong encoding index 84 for GB12345 (expected 83) (EncodingError)
| 	from -:20:in 'block (3 levels) in <main>'
| 	from -:19:in 'Array#each'
| 	from -:19:in 'block (2 levels) in <main>'
| /tmp/ruby/src/trunk/tool/lib/core_assertions.rb:297:in 'Marshal.dump': no _dump_data is defined for class Ractor (TypeError)
| 	from /tmp/ruby/src/trunk/tool/lib/core_assertions.rb:297:in 'block in Test::Unit::CoreAssertions#separated_runner'
| -:25:in 'Ractor.select': thrown by remote Ractor. (Ractor::RemoteError)
| 	from -:25:in '<main>'
| -:20:in 'String#force_encoding': wrong encoding index 84 for GB12345 (expected 83) (EncodingError)
| 	from -:20:in 'block (3 levels) in <main>'
| 	from -:19:in 'Array#each'
| 	from -:19:in 'block (2 levels) in <main>'
| -:25:in 'Ractor.select': thrown by remote Ractor. (Ractor::RemoteError)
| 	from -:25:in '<main>'
| -:20:in 'String#force_encoding': wrong encoding index 84 for GB12345 (expected 83) (EncodingError)
| 	from -:20:in 'block (3 levels) in <main>'
| 	from -:19:in 'Array#each'
| 	from -:19:in 'block (2 levels) in <main>'
1) Failure:

But can't be certain

@casperisfine casperisfine force-pushed the encoding-must-autoload branch from 889cd45 to d59faa7 Compare July 22, 2025 09:38
Otherwise we may be checking the index while the encoding
is being autoloaded by another ractor.
@casperisfine casperisfine force-pushed the encoding-must-autoload branch from d59faa7 to 93601e0 Compare July 22, 2025 09:48
@byroot byroot merged commit 8541dec into ruby:master Jul 22, 2025
84 checks passed
@casperisfine casperisfine deleted the encoding-must-autoload branch July 22, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy