Project

General

Profile

Actions

Bug #18560

closed

"Compaction isn't available on this platform" error running PG test suite on ppc64le

Added by vo.x (Vit Ondruch) about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [powerpc64le-linux]
[ruby-core:107392]

Description

Trying to execute test suite of pg gem on ppc64le, I observe a following error:

... snip ...

  1) GC.compact should compact PG::TypeMapByClass #328
     Failure/Error: GC.verify_compaction_references(toward: :empty, double_heap: true)
     NotImplementedError:
       Compaction isn't available on this platform
     # <internal:gc>:257:in `verify_compaction_references'
     # ./spec/pg/gc_compact_spec.rb:58:in `block (2 levels) i

... snip ...

This is surprising, given that the test suite seems to do reasonable effort to guard this behavior 1:

... snip ...

describe "GC.compact", if: GC.respond_to?(:compact) do

... snip ...

Is this expected or bug?


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #18779: `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. ClosedActions

Updated by peterzhu2118 (Peter Zhu) about 2 years ago

I think this is expected. GC.compact, GC.auto_compact=, GC.verify_compaction_references will raise NotImplementedError when compaction is not supported on the platform.

GC.respond_to?(:compact) is just to check that the method GC.compact exists (this method was added in Ruby 2.7).

Updated by mame (Yusuke Endoh) about 2 years ago

@peterzhu2118 (Peter Zhu) JFYI: If the method body is rb_f_notimplement, Kernel#respond_to? returns false.

For example, Kernel#fork is defined as such in Windows. https://github.com/ruby/ruby/blob/605f226142a47c4f9e4cc88717c5d6170bc3d7f1/process.c#L4431

PS C:\> ruby -ve 'p respond_to?(:fork); fork'
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
false
-e:1:in `fork': fork() function is unimplemented on this machine (NotImplementedError)
        from -e:1:in `<main>'

However, I think it is currently impossible to define such a method in Ruby code, i.e., gc.rb. I have no opinion whether it is worth putting effort on this.

Actions #3

Updated by vo.x (Vit Ondruch) about 2 years ago

Thx for the clarification. For now, I have reported the original issue to the PG upstream [1]. Keeping this open should there be a chance to follow the fork example.

[1] https://github.com/ged/ruby-pg/issues/423

Updated by Eregon (Benoit Daloze) about 2 years ago

FWIW, TruffleRuby has Primitive.method_unimplement specifically to achieve to achieve the same as rb_f_notimplement but in Ruby code.
Example usage: https://github.com/oracle/truffleruby/blob/4eddae9d18137567beb25e6e4ef2c932fa9de7ab/src/main/ruby/truffleruby/core/kernel.rb#L759

Updated by jaruga (Jun Aruga) almost 2 years ago

I remember the Ruby disabled GC compaction on platforms that can't support it, on #17871 .

Actions #6

Updated by Eregon (Benoit Daloze) almost 2 years ago

  • Has duplicate Bug #18779: `GC.compact` and other compaction related methods should be defined as rb_f_notimplement on non supported platforms. added

Updated by Eregon (Benoit Daloze) almost 2 years ago

  • Status changed from Open to Closed

This seems the same as #18779, which just got fixed.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0