現在位置: ホーム / みらくるブログ / Linux OS の障害対処-4

Linux OS の障害対処-4

core dump の解析に挑戦してみました。

こんにちは、ニックネーム たいちょう です。

前回は、Asianux Server 7 on Microsoft Azure で kdump を採ってみたのでしたね。

今回は、私が遭遇したある segmentation fault を core dump して、それを解析してみようと思います。

ネットワーク編でも大変便利に使わせてもらっている、GNS3 なんですけど、最近、閉じる時に segmentation fault を起こすようになりました。
不安定版が好きで、なんでもすぐにアップデートしてしまう、私のやりかたも問題だとは思っていますけど、GNS3 の使用自体には何も問題はなく、立ち上げたプロジェクトもちゃんと保存されていますし、ここは、障害をいいチャンスととらえて、できればコミュニティに貢献できたらと考えました。

ところで、閉じるボタンをクリックした時の表示は、segmentation fault (コアダンプ)となっていました。でも、core ファイルは保存されていないようです。

core ファイルが出力されるようにします。

# vim /etc/security/limits.conf

以下を追加しました。

*               soft    core            unlimited
*               hard    core            unlimited
# vim /etc/sysctl.conf

以下を追加しました。

 

kernel.core_pattern=/var/core/%t-%e-%p-%c.core
kernel_core_uses_pid=0
fs.suid_dumpable=1

 

# mkdir /var/core

gns3 は、一般ユーザー(ここでは、taichou とします)で実行しています。
一般ユーザーでも、/var/core にファイルが書けるようにします。

# chmod 777 /var/core
# shutdown -r now

GNS3 を閉じると、コアダンプするという現象を確認しているので、コアを吐かせてみます。

$ gns3

右上の×をクリックして、閉じます。

segmentation fault (コアダンプ)
$ ls -lh /var/core
-rw-------.  1 taichou taichou 154M  4月 29 06:04 1461877484-QDBusConnection-4244-18446744073709551615.core

取れたー!

gdb で解析します。

$ gdb gns3 1461877484-QDBusConnection-4244-18446744073709551615.core
GNU gdb (GDB) Fedora 7.10.1-31.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/usr/bin/gns3": not in executable format: ファイル形式が認識できません
Illegal process-id: 1461877484-QDBusConnection-4244-18446744073709551615.core.
[New LWP 4250]
[New LWP 4244]
[New LWP 4252]
[New LWP 4253]
[New LWP 4256]
[New LWP 4249]
[New LWP 4259]
[New LWP 4274]
Missing separate debuginfo for the main executable file
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/89/a578f7184a82bbfc22299c0a022a3b2c5600b9
Core was generated by `/usr/bin/python3 /usr/bin/gns3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fa532561e97 in ?? ()
[Current thread is 1 (LWP 4250)]
(gdb) bt
#0  0x00007fa532561e97 in ?? ()
#1  0x00007fa50e624c70 in ?? ()
#2  0x0000000000000000 in ?? ()
(gdb)

これじゃなんだか、わかりません。

debuginfo パッケージをインストールしてないからっぽいです。
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/89/a578f7184a82bbfc22299c0a022a3b2c5600b9
とあるので、以下のコマンドを実行しました。

# dnf --enablerepo='*debug*' install -y /usr/lib/debug/.build-id/89/a578f7184a82bbfc22299c0a022a3b2c5600b9

このコマンドにより、python3-debuginfo がダウンロードされました。

では、もう一度挑戦してみます。

$ gdb gns3 /var/core/1461877484-QDBusConnection-4244-18446744073709551615.core
GNU gdb (GDB) Fedora 7.10.1-31.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/usr/bin/gns3": not in executable format: ファイル形式が認識できません
[New LWP 4250]
[New LWP 4244]
[New LWP 4252]
[New LWP 4253]
[New LWP 4256]
[New LWP 4249]
[New LWP 4259]
[New LWP 4274]

warning: core file may not match specified executable file.
Reading symbols from /usr/bin/python3.4m...Reading symbols from /usr/lib/debug/usr/bin/python3.4m.debug...done.
done.

warning: Ignoring non-absolute filename: <linux-vdso.so.1>
Missing separate debuginfo for linux-vdso.so.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/9c/4c65d50af12ff350e7931f1413ae783a37d449
Missing separate debuginfo for /usr/lib64/python3.4/site-packages/psutil/_psutil_linux.cpython-34m.so
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/6a/cec03274b9fdc59115fc3167963d7b340248ad
Missing separate debuginfo for /usr/lib64/python3.4/site-packages/psutil/_psutil_posix.cpython-34m.so
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/69/3631706e7e38854d1379afd37791653ac1d343
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/python3 /usr/bin/gns3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fa532561e97 in QObject::disconnect(QObject const*, char const*, QObject const*, char const*) ()
   from /lib64/libQt5Core.so.5
[Current thread is 1 (Thread 0x7fa50e625700 (LWP 4250))]
Missing separate debuginfos, use: dnf debuginfo-install GConf2-3.2.6-15.fc23.x86_64 PackageKit-gtk3-module-1.0.11-1.fc23.x86_64 ...(snip)... xcb-util-wm-0.4.1-6.fc23.x86_64 xz-libs-5.2.1-3.fc23.x86_64 zlib-1.2.8-9.fc23.x86_64
(gdb)

うまくいっているみたいです。
bt と打ってみます。

(gdb) bt
#0  0x00007fa532561e97 in QObject::disconnect(QObject const*, char const*, QObject const*, char const*) ()
    at /lib64/libQt5Core.so.5
#1  0x00007fa5295d99d8 in QDBusConnectionPrivate::closeConnection() () at /lib64/libQt5DBus.so.5
#2  0x00007fa5295ca596 in QDBusConnectionManager::run() () at /lib64/libQt5DBus.so.5
#3  0x00007fa53235de18 in QThreadPrivate::start(void*) () at /lib64/libQt5Core.so.5
#4  0x00007fa53f96660a in start_thread () at /lib64/libpthread.so.0
#5  0x00007fa53ef97a4d in clone () at /lib64/libc.so.6
(gdb)

まだわからないな。

アドバイスどおりに、以下のコマンドを実行してみました。

# dnf debuginfo-install -y GConf2-3.2.6-15.fc23.x86_64 ...(snip)... zlib-1.2.8-9.fc23.x86_64
...(snip)... 169 パッケージのインストールが完了しました。

もう一度やってみます。

$ gdb gns3 /var/core/1461877484-QDBusConnection-4244-18446744073709551615.core

 

GNU gdb (GDB) Fedora 7.10.1-31.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/usr/bin/gns3": not in executable format: ファイル形式が認識できません
[New LWP 4250]
[New LWP 4244]
[New LWP 4252]
[New LWP 4253]
[New LWP 4256]
[New LWP 4249]
[New LWP 4259]
[New LWP 4274]

warning: core file may not match specified executable file.
Reading symbols from /usr/bin/python3.4m...Reading symbols from /usr/lib/debug/usr/bin/python3.4m.debug...done.
done.
warning: Ignoring non-absolute filename: <linux-vdso.so.1>
Missing separate debuginfo for linux-vdso.so.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/9c/4c65d50af12ff350e7931f1413ae783a37d449
Missing separate debuginfo for /usr/lib64/python3.4/site-packages/psutil/_psutil_linux.cpython-34m.so
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/6a/cec03274b9fdc59115fc3167963d7b340248ad
Missing separate debuginfo for /usr/lib64/python3.4/site-packages/psutil/_psutil_posix.cpython-34m.so
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/69/3631706e7e38854d1379afd37791653ac1d343

warning: .dynamic section for "/usr/lib64/libQt5SerialPort.so.5.6.0" is not at the expected address (wrong library or version mismatch?)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/bin/python3 /usr/bin/gns3'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fa532561e97 in QObject::disconnect (sender=0x7fa4f40283c0, signal=signal@entry=0x0, receiver=receiver@entry=0x7fa508008930,
    method=method@entry=0x0) at kernel/qobject.cpp:2949
2949        const QMetaObject *smeta = sender->metaObject();
[Current thread is 1 (Thread 0x7fa50e625700 (LWP 4250))]

やっとそれらしい表示が出ました。

frame 0 を確認します。

(gdb) frame 0
#0  0x00007fa532561e97 in QObject::disconnect (sender=0x7fa4f40283c0, signal=signal@entry=0x0, receiver=receiver@entry=0x7fa508008930,
    method=method@entry=0x0) at kernel/qobject.cpp:2949

うーーん、見かけの現象(close ボタンをクリックすると、signal が飛んで...)がオブジェクトになって見えているようにしかわかりません。

この警告は関係あるのかな?

warning: .dynamic section for "/usr/lib64/libQt5SerialPort.so.5.6.0" is not at the expected address (wrong library or version mismatch?)

結局、よくわかりませんでした。

他にも、困っている人がいるかもしれないので、とりあえず GNS3 のコミュニティに報告しておきます。

https://community.gns3.com/qa/gns3-1-46-segfaults-on-fedora23-

1時間後に確認したら、、うわぁ!もう返事きたし。

なんだか、開発者が、興味持ってくれて、調べてくれるらしいです!!


私が質問したスレッドはユーザーのスレッドだったので、開発者のスレッド ( devs ) に報告してくれるらしいです。

簡単にお礼だけ言っておきました。

解決できるといいなぁ。

たとえ問題が解決できなくても、今回は報告できて、開発者に興味を示してもらったので大成功といったところです。

オープンソースって楽しいなぁ。。

今日はこの辺で、お疲れさまでした。ニックネーム たいちょう でした。

次回もお楽しみに。

 

松江ラボ エンジニア募集中

詳細へ暮らしやすさ日本一の水の都、そしてオープンソースの都、
松江で一緒に働くエンジニアを募集しています。
タグ: