クラッシュ(セグメンテーションフォルト)の報告と分析

クラッシュ(セグメンテーションフォルト)の報告と分析

Julia を壊した?おめでとうございます! 何かおかしいことが起きた時によく遭遇する症状に対する一般的な手順をここに集めました。セグメンテーションフォールトを追跡したり、あなたのスクリプトが予想よりも遅い理由を突き止める際には、ここで述べるデバッグ手順から得られる情報を含めて報告すると、メンテナは大いに助かるでしょう。

もしあなたが、このページを見るように、と言われたのであれば、今直面している問題に最も一致する現象を見つけて、このページに書かれた指示に従って、要求されたデバッグ情報を生成してください。現象の一覧は下記の通りです:

バージョン情報/環境情報

エラーの内容に関係なく、常に、実行しているJulia のバージョンを知る必要があります。Julia が最初に起動すると、ヘッダーにバージョン番号と日付が出力されます。また、作成するレポートには、versioninfo()(InteractiveUtils 標準ライブラリからエクスポートされています) の出力を含めてください:

julia> using InteractiveUtils

julia> versioninfo()
Julia Version 1.1.1
Commit 55e36cc308* (2019-05-16 04:10 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Xeon(R) W-2155 CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

ブートストラップ(sysimg.jl)中のセグメンテーションフォルト

Julia をビルドする make プロセスの終盤でのセグメンテーションフォールトは、一般的な症状です。Julia がbase/フォルダ内のコードのコーパスを事前解析している間に何かがおかしいことが起きたりします。 プロセスが突然落ちてしまう原因には、多くの要因が考えられますが、どちらかというと、Julia の C コード部分のエラーが原因であることが多く、通常は gdb のデバッグビルドでデバッグしなければならないことが多いです。デバッグビルドを作るには明示的に:

Julia のデバッグビルドを作成します:

$ cd <julia_root>
$ make debug

このデバッグビルドのプロセスは、通常のmake と同じエラーで失敗する可能性がありますが、(そうならなければ) 正確なバックトレースをするために必要なデバッグシンボルを gdbに提供する、デバッグ用実行可能ファイルが作成されます。 次に、gdb内でブートストラッププロセスを手動で実行します:

$ cd base/
$ gdb -x ../contrib/debug_bootstrap.gdb

このコマンドで、gdbを開始し、Julia のデバッグビルドを使用したブートストラッププロセスを実行しようとし、もしセグメンテーションフォルトが起きれば、バックトーレスの結果を出力します。全ての出力を得るには、なんどか <enter>キーを押す必要があるかもしれません。こうして得られたバックトレースと、バージョン情報、その他関連情報をまとめた gist を作成して、Github の issue をオープンし、作成したgistへのリンクを貼ってください。

スクリプトの実行時のセグフォールト

The procedure is very similar to Segfaults during bootstrap (sysimg.jl). Create a debug build of Julia, and run your script inside of a debugged Julia process:

$ cd <julia_root>
$ make debug
$ gdb --args usr/bin/julia-debug <path_to_your_script>

Note that gdb will sit there, waiting for instructions. Type r to run the process, and bt to generate a backtrace once it segfaults:

(gdb) r
Starting program: /home/sabae/src/julia/usr/bin/julia-debug ./test.jl
...
(gdb) bt

Create a gist with the backtrace, the version info, and any other pertinent information you can think of and open a new issue on Github with a link to the gist.

Julia起動中のエラー

Occasionally errors occur during Julia's startup process (especially when using binary distributions, as opposed to compiling from source) such as the following:

$ julia
exec: error -5

These errors typically indicate something is not getting loaded properly very early on in the bootup phase, and our best bet in determining what's going wrong is to use external tools to audit the disk activity of the julia process:

Create a gist with the strace/ dtruss output, the version info, and any other pertinent information and open a new issue on Github with a link to the gist.

Glossary

A few terms have been used as shorthand in this guide: