klayout crashed when doing some merge/boolean operations

edited July 2012 in General
Hi Matthias,

We are trying to merge some database files or boolean layers, however sometimes this kind of action would cause klayout crash and show "Segmentation fault". According to the message it should be the bug of ruby library, we tried to upgrade the ruby library version from p249 to p334, but the problem is still there, could you please help to confirm what happened ? thanks for your kindly support~

QPaintEngine::setSystemClip: Should not be changed while engine is active
QPaintEngine::setSystemClip: Should not be changed while engine is active
QWidgetPrivate::beginSharedPainter: Painter is already active
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::begin: A paint device can only be painted by one painter at a time.
QPaintEngine::setSystemClip: Should not be changed while engine is active
QPaintEngine::setSystemClip: Should not be changed while engine is active
[BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]

After upgrade ruby version, all the error messages are the same.

[BUG] Segmentation fault
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]

Best Regards,
--
chhung

Comments

  • edited July 2012

    Hi chhung,

    The error message is not related to Ruby, although the message may suggest that. Ruby is not responsible for that problem, it just happens to register a signal handler for the segmentation fault. Also the warnings you mentioned are likely not to be the cause of the problem.

    It's actually somewhat hard to track down what is the cause of the problem. There are some things you could try

    • I have experienced a problem with gcc 4.1.2 that leads to a segmentation fault in the boolean operations. That problem seems to be gone in gcc 4.3.3 and later. If you are using a gcc older than 4.3.3 it may be worth trying to use a more recent one
    • For larger inputs, the flat boolean operations may allocate a lot of memory. Usually that leads to "bad alloc" errors, but I cannot rule out that segmentation faults may be cause. Maybe you can check whether that is the case (i.e. by observing the processes' memory)
    • I am not aware of severe bugs in the boolean algorithm, but of course that cannot be ruled out. I have rewritten large parts of the scanline algorithm in 0.22 for performance reasons. Maybe you can check the snapshot on http://www.klayout.de/build.html. If there is a bug, there is some chance that it is gone in that version.
    • If you had a stack trace (run klayout in the gdb and ust the "bt" command when the segmentation fault occured), that could help to narrow down the cause.
    • If all of that fails, maybe you can reduce your data to some testcase small enough so it is possible to send it to me. I could then try to debug the problem.

    Best regards,

    Matthias

  • edited July 2012
    Hi Matthias,

    I spent some time to confirm the strange problem and sorry to reply so late.

    Although the ruby version has been upgraded from 1.8.7 p334 to 1.9.3 p194, the segmentation fault issue is still there. The most unbelievable thing is the situation would happen randomly, the same operation steps may success this time, however fail next time.

    To upgrade gcc version is a bit difficult on our system, I'll try to compile the snapshot version for the new scanline algorithm, really appreaciate your kindly support.

    Much more info was generated with ruby 1.9.3 p194, I have no idea if it helps and will paste some here.

    -e: [BUG] Segmentation fault
    ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

    -- Control frame information -----------------------------------------------
    c:0001 p:0000 s:0002 b:0002 l:000c38 d:000c38 TOP


    -- C level backtrace information -------------------------------------------
    /usr/local/klayout/lib64/test/libruby.so.1.9(rb_vm_bugreport+0x82) [0x7fc27a3f6542]
    /usr/local/klayout/lib64/test/libruby.so.1.9 [0x7fc27a3049b4]
    /usr/local/klayout/lib64/test/libruby.so.1.9(rb_bug+0xa9) [0x7fc27a304a89]
    /usr/local/klayout/lib64/test/libruby.so.1.9 [0x7fc27a39b8c7]
    /lib64/tls/libc.so.6 [0x7fc2784d7b60]
    /usr/local/klayout/lib64/test/libQtGui.so.4(_ZNK8QPainter8isActiveEv+0x11) [0x7fc2799d7371]
    /usr/local/klayout/lib64/test/libQtGui.so.4(_ZNK8QPainter8clipPathEv+0x35) [0x7fc2799d8dd5]
    many messages about Qt4 and Glib........

    /lib64/tls/libc.so.6(__libc_start_main+0xda) [0x7fc2784c54fa]
    /usr/local/klayout/bin64/test/klayout(_ZNSsC1ERKSsmm+0x3a) [0x7d3e1a] ../sysdeps/x86_64/elf/start.S:113

    -- Other runtime information -----------------------------------------------

    * Loaded script: -e

    * Loaded features:

    0 enumerator.so
    1 /usr/lib64/ruby/1.9.1/x86_64-linux/enc/encdb.so
    2 /usr/lib64/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
    3 /usr/lib64/ruby/1.9.1/rubygems/defaults.rb
    4 /usr/lib64/ruby/1.9.1/x86_64-linux/rbconfig.rb
    5 /usr/lib64/ruby/1.9.1/rubygems/deprecate.rb
    6 /usr/lib64/ruby/1.9.1/rubygems/exceptions.rb
    7 /usr/lib64/ruby/1.9.1/rubygems/custom_require.rb
    8 /usr/lib64/ruby/1.9.1/rubygems.rb
    9 /usr/lib64/ruby/1.9.1/x86_64-linux/stringio.so

    * Process memory map:

    00400000-01836000 r-xp 00000000 00:11 805743154 /usr/local/klayout/bin64/test/klayout
    01935000-01967000 rw-p 01435000 00:11 805743154 /usr/local/klayout/bin64/test/klayout
    01967000-2e07b000 rw-p 00000000 00:00 0 [heap]
    405c8000-405c9000 ---p 00000000 00:00 0
    etc.....

    [NOTE]
    You may have encountered a bug in the Ruby interpreter or extension libraries.
    Bug reports are welcome.
    For details: http://www.ruby-lang.org/bugreport.html

    Best Regards,
    --
    chhung
  • edited July 2012
    Hi Matthias,

    I tried to compile the klayout-r1335 with all the same setting to compile klayout v0.21.19, however failed with the following error, could you please let me know how to fix the problem? Thanks~

    /source/klayout-r1335/src/layGenericSyntaxHighlighter.cc:593: error: no matching function for call to `QRegExp::capturedTexts() const'

    /usr/lib/qt4/include/QtCore/qregexp.h:113: note: candidates are: QStringList QRegExp::capturedTexts() <near match>

    /source/klayout-r1335/src/layGenericSyntaxHighlighter.cc:594: error: no matching function for call to `QRegExp::capturedTexts() const'

    /usr/lib/qt4/include/QtCore/qregexp.h:113: note: candidates are: QStringList QRegExp::capturedTexts() <near match>

    make[1]: *** [layGenericSyntaxHighlighter.o] Error 1


    Best Regards,
    --
    chhung
  • edited July 2012

    Hi chhung,

    Apparently Qt switched to a const version of capturedTexts somewhere between Qt 4.2 and 4.5. You can fix the compile problem by using a const cast in line 593 and 594:

    Replace

    m_re.capturedTexts() 
    

    with

    const_cast<QRegExp &>(m_re).capturedTexts()
    

    Hope that helps. I will check the build against some older Qt version before I release it.

    Best regards,

    Matthias

  • edited July 2012
    Hi Matthias,

    I modified the capturedTexts section in layGenericSyntaxHighlighter.cc, and encountered other problems.

    rba.cc:
    /source/klayout-r1335/src/rba.cc: In member function `void rba::GetBoxValueFunc::op()':
    /source/klayout-r1335/src/rba.cc:1250: error: expected primary-expression before '>' token
    /source/klayout-r1335/src/rba.cc:1250: error: expected primary-expression before ')' token
    make[1]: *** [rba.o] Error 1

    It's caused by the following codes, however I don't know where the error is~

    if (bo) {
    mp_ret = bo->value ().morph<R> ().native_ptr ();
    }


    layMacroEditorPage.cc:
    /source/klayout-r1335/src/layMacroEditorPage.cc: In member function `void lay::MacroEditorPage::breakpoints_changed()':
    /source/klayout-r1335/src/layMacroEditorPage.cc:434: error: 'class QTextBlock' has no member named 'firstLineNumber'
    /source/klayout-r1335/src/layMacroEditorPage.cc: In member function `void lay::MacroEditorPage::text_changed()':
    /source/klayout-r1335/src/layMacroEditorPage.cc:454: error: 'const class QTextBlock' has no member named 'firstLineNumber'
    /source/klayout-r1335/src/layMacroEditorPage.cc: In member function `void lay::MacroEditorPage::ensure_line_visible(int)':
    /source/klayout-r1335/src/layMacroEditorPage.cc:511: error: 'class QTextBlock' has no member named 'firstLineNumber'

    Best Regards,
    --
    chhung
  • edited November -1

    Hi chhung,

    what gcc version are you using? It appears to be a pretty old one. Also Qt appears to be an older one.

    I'd recommend gcc >=4.3.x and Qt >=4.5.x. I'll try to fix it for Qt >=4.2.x - that is the oldest version for which that makes sense.

    Best regards,

    Matthias

  • edited November -1
    Hi Matthias,

    Our gcc version is 3.4.3 and Qt is 4.4.3, I know it's very old but we have to keep it running.

    I tried to setup a CentOS(RHEL) 6.2 with gcc 4.4.6 and Qt 4.6.2, it could be used to compile either 0.21.19 or r1335 well, however the compiled binary code could not work on our old workstation because of the glibc blahblah library problem.

    I'll look for a way to install newer gcc version on our Mandrake Linux workstation and try to compile the code again, thanks for your kindly help~

    Best Regards,
    --
    chhung
Sign In or Register to comment.