ongaeshi
ongae****@gmail*****
2012年 11月 4日 (日) 18:26:00 JST
ongaeshiです。 ===================================== 64bit版rroongaでMilkodeを動かす NougakuDo 1.3.4 にて 64bit版Windowsで最適に動作するrroongaが 同梱されたため、Milkodeをインストールして動かしてみました。 結果としては、過去にRubyInstaller経由で動かした時と同じように レコード数が10000を超えた辺りで"syscall error 'CreateFile'"が 発生してしました。 --- ここから --- Z:\Documents\Parallels\win7_data\Users>milk add tmp\dummydata2 [warning] already exist 'dummydata2'. package : dummydata2 C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:73:in `[]=': unknown error: syscall error 'CreateFile' ( unknown error): #<Groonga::VariableSizeColumn id: <260>, name: <documents.content>, path: <Z:/Documents/Parallels/win7_data/Users/.milkode/db/milkode.db.0000104>, domain: <documents>, range: <Text>, flags: <>> (Groonga::UnknownError) C:\Users\arton\Documents\projects\groonga-2.0.7\lib\io.c:1636: grn_open() from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:73:in `set_column_value' from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:73:in `[]=' from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:41:in `block in initialize' from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:40:in `each' from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:40:in `initialize' from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/milkode-0.9.3.1/lib/milkode/database/document_table.rb:69:in `new' --- ここまで --- 今までrroongaがWindowsで上手く動作しないのは32bit版だから と予想していたのですが、もしかして他に原因があるのかもしれない と思い調べてみました。 ===================================== 再現環境を作ってみました ongaeshi/rroonga_windows_test https://github.com/ongaeshi/rroonga_windows_test インストール方法は README.md を参考にして下さい 上記に同梱されたスクリプトを【二回】実行する事でエラーが 再現出来ます。やっていることとしては、 # 1回目の実行 1. サンプルデータをダウンロード、zipファイルを展開 2. Milkodeとほぼコンパチなデータベースを作成 3. 展開されたファイルをfindで辿りながらレコードに登録 4. 全てのレコードの path(ファイル名), content(ファイルの内容) を表示 5. 1回目の実行は成功する # 2回目の実行 1. 1回目で作成したデータベースを開く 2. 全てのレコードの path(ファイル名), content(ファイルの内容) を表示 3. レコード 'test/ruby/test_transcode.rb' の record.content の【内容を取得時】に、 "syscall error 'CreateFile'"が発生してプログラム停止 以下、エラーの内容です。 --- ここから --- Z:/Documents/rroonga-windows-test/download/ruby-1.9.2-p290-2/ruby-1.9.2-p290/test/ruby/test_transcode.rb C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:329:in `[]': unknown error: syscall error 'CreateFile' (unknown error): #<Groonga::VariableSizeColumn id: <260>, name: <documents.content>, path: <database/test.db.0000104>, domain: <documents>, range: <Text>, flags: <>> (Groonga::UnknownError) C:\Users\arton\Documents\projects\groonga-2.0.7\lib\io.c:1636: grn_open() from C:/Users/ongaeshi/AppData/Roaming/NOUGAK~1/lib/ruby/gems/1.9.1/gems/rroonga-2.0.6/lib/groonga/record.rb:329:in `method_missing' from test-04-download.rb:174:in `block in access_test' from test-04-download.rb:171:in `each' from test-04-download.rb:171:in `access_test' from test-04-download.rb:199:in `<main>' --- ここまで --- 何回かスクリプトを実行しても、私の環境ではいつも同じ箇所で エラーが起きました。 RubyInstaller + DevKit でインストールした rroonga でも試して みましたが、ファイル名は違うものの大体同じような箇所で エラーが起きました。 --- ここまで --- Z:/Documents/rroonga_windows_test/download/ruby-1.9.2-p290-2/ruby-1.9.2-p290/test/ruby/test_string.rb C:/Ruby193/lib/ruby/gems/1.9.1/gems/rroonga-2.0.4/lib/groonga/record.rb:326:in `[]': unknown error: syscall error 'CreateFile' (unknown error): #<Groonga::VariableSizeColumn id: <260>, name: <documents.content>, path: <database/test.db.0000104>, domain: <documents>, range: <Text>, flags: <>> (Groonga::UnknownError) io.c:1628: grn_open() from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rroonga-2.0.4/lib/groonga/record.rb:326:in `method_missing' from main.rb:207:in `block in access_test' from main.rb:204:in `each' from main.rb:204:in `access_test' from main.rb:232:in `<main>' --- ここまで --- ※ OSXのrroongaなら最後まで実行出来ます。 ===================================== まとめ 1. Windows版rroongaで10000位のレコードを登録すると"syscall error 'CreateFile'"エラーが発生する 2. rroonga 64bit版、32bit版に関わらず、同じような場所で起きる 3. エラーは io.c:1628: grn_open() で辺りで起きている この辺り? http://kodeworld.ongaeshi.me/home/rroonga-2.0.6/vendor/groonga-2.0.7/lib/io.c?query=%2Frroonga-2.0.6%2Fvendor%2Fgroonga-2.0.7%2Flib%2Fio.c%3A1636&shead=package#n1636 エラー内容から推測するに、すでに存在する 'test.db.0000104' を CreateFile(CREATE_NEW) しようとしてエラーが起きていると予想 4. 上記のテストスクリプトは main.rb の 207 行目 table.each do |record| path = record.path puts path # content = record.content end をコメントアウトすると正常終了するようになる。 record.path はファイル名, record.content はファイル内容を 保持しており、データサイズの大きなカラムのアクセス時に エラーが起きている? (もしくはtextカラム) 5. エラーはいつも、*.db.0000104 で起きていた ===================================== まずは分かる範囲で情報を集めてみました、 原因特定の一助となれば幸いです。 他に調べた方がいいことがありましたら教えて下さい。 また他のWindows環境でも再現するのか、スクリプトを 動かした方がいましたら教えて頂けるとありがたいです。 よろしくお願い致します。 -- /****************************************** ongaeshi MAIL: ongae****@gmail***** WEB: http://ongaeshi.me Twitter: http://twitter.com/ongaeshi ******************************************/