klayout icon indicating copy to clipboard operation
klayout copied to clipboard

batch ruby SIGSEGV due: ly.each_cell.find ... (to find non-empty layers), in 0.27.4 & 0.29.1, libruby.so.2.0

Open sto6 opened this issue 8 months ago • 9 comments

Trying empty layer code suggested from #1734. ly.each_cell.find { |c| !c.shapes(li).is_empty? } Multiple klayout versions (pre/post 0.29.0) on centos-7.9 (libruby.so.2.0) crash. The 0.29.1 build used is from your klayout.de, thank you.

As if, just after the first non-empty layer found that way, klayout becomes unstable: crash occurs on next same check (same or another layer), or in exit.

Attached OASIS test-case, klayout script, two logs (script outputs with crash-log). Script ensures that despite differing layer_indexes from the two klayout versions (on same OASIS file), the empty-layer check is done at least once more after a non-empty layer (triggering the crash).

A taste of the logs:

% head -30 klay-tst4-0.27.4.log klay-tst4-0.29.1.log
==> klay-tst4-0.27.4.log <==
RUBY_VERSION=2.0.0
indices: [0]
indices: [0]   do_1: false
indices: [0]   do_3: false
test index 0:
... not_empty_0.class: RBA::Cell
test index 0 (again):
ERROR: Signal number: 11
Address: 0x2c
Program Version: KLayout 0.27.4 (2021-10-28 rLatestSourcePackage)

Backtrace:
/apps/klayout/0.27.4/libklayout_lay.so.0 +0x4bbc04 lay::enable_signal_handler_gui(bool) [??:?]
/lib64/libpthread.so.0 +0xf630 __restore_rt [sigaction.c:?]
/lib64/libruby.so.2.0 +0x16d958 rb_call_super [??:?]
/lib64/libruby.so.2.0 +0x171a20 rb_yield [??:?]
/lib64/libruby.so.2.0 +0x5fa5e rb_enum_values_pack [??:?]
/lib64/libruby.so.2.0 +0x171c80 rb_yield [??:?]
/lib64/libruby.so.2.0 +0x69d0b rb_protect [??:?]
/apps/klayout/0.27.4/libklayout_rba.so.0 +0xbc66a std::move_iterator<std::pair<std::string, gsi::MethodBase const*>*>::base() const [??:?]
/apps/klayout/0.27.4/libklayout_rba.so.0 +0x82a53 rba::RubyStackTraceProvider::stack_depth() const [??:?]
/apps/klayout/0.27.4/libklayout_rba.so.0 +0x8369e rba::RubyStackTraceProvider::stack_depth() const [??:?]
/apps/klayout/0.27.4/libklayout_rba.so.0 +0x8ca4e void* gsi::SerialArgs::read<void*>(tl::Heap&) [??:?]
/lib64/libruby.so.2.0 +0x164593 rb_catch [??:?]
/lib64/libruby.so.2.0 +0x174034 rb_each [??:?]
/lib64/libruby.so.2.0 +0x163f4e rb_iterate [??:?]
/lib64/libruby.so.2.0 +0x1640bb rb_block_call [??:?]
/lib64/libruby.so.2.0 +0x164593 rb_catch [??:?]
/lib64/libruby.so.2.0 +0x174034 rb_each [??:?]
/lib64/libruby.so.2.0 +0x163f4e rb_iterate [??:?]

==> klay-tst4-0.29.1.log <==
RUBY_VERSION=2.0.0
indices: [0, 1, 2, 3]
indices: [0, 1, 2, 3]   do_1: true
indices: [0, 1, 2, 3]   do_3: true
test index 0:
... not_empty_0.class: NilClass
test index 3:
... not_empty_3.class: RBA::Cell
test index 1:
ERROR: Signal number: 11
Address: 0x18
Program Version: KLayout 0.29.1 (2024-05-04 rf95aef8)

Backtrace:
/usr/lib64/klayout/libklayout_lay.so.0 +0x29778e lay::enable_signal_handler_gui(bool) [??:?]
/lib64/libpthread.so.0 +0xf630 __restore_rt [sigaction.c:?]
/lib64/libruby.so.2.0 +0x16d958 rb_call_super [??:?]
/lib64/libruby.so.2.0 +0x171a20 rb_yield [??:?]
/lib64/libruby.so.2.0 +0x5fa5e rb_enum_values_pack [??:?]
/lib64/libruby.so.2.0 +0x171c80 rb_yield [??:?]
/lib64/libruby.so.2.0 +0x69d0b rb_protect [??:?]
/usr/lib64/klayout/libklayout_rba.so.0 +0x45a8b void std::vector<std::pair<std::string, gsi::MethodBase const*>, std::allocator<std::pair<std::string, gsi::MethodBase const*> > >::_M_emplace_back_aux<std::pair<std::string, gsi::MethodBase const*> >(std::pair<std::string, gsi::MethodBase const*>&&) [??:?]
/usr/lib64/klayout/libklayout_rba.so.0 +0x2567a rba::RubyInterpreter::add_package_location(std::string const&) [??:?]
/lib64/libruby.so.2.0 +0x164593 rb_catch [??:?]
/lib64/libruby.so.2.0 +0x174034 rb_each [??:?]
/lib64/libruby.so.2.0 +0x163f4e rb_iterate [??:?]
/lib64/libruby.so.2.0 +0x1640bb rb_block_call [??:?]
/lib64/libruby.so.2.0 +0x164593 rb_catch [??:?]
/lib64/libruby.so.2.0 +0x174034 rb_each [??:?]
/lib64/libruby.so.2.0 +0x163f4e rb_iterate [??:?]

klay-empty-crash.tgz

sto6 avatar Jun 13 '24 10:06 sto6