LoginSignup
1
2

More than 5 years have passed since last update.

Rails5 + sqlite3のrails consoleでsqliteのエラーでハマったこと

Posted at

動作環境

rails 5.0.0.1
sqlite3 3.14.0

rails consoleで直にActiveRecord叩いたら以下のエラーがでてハマった。

$ rails console
irb(main):001:0> Message.create! content: 'Hello world!'
/Users/hiromichi.ema/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:27: [BUG] Segmentation fault at 0x00000000000110
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports

     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
# 略

参考にしたのはこのあたり

http://stackoverflow.com/questions/39969734/rails-5-bug-segmentation-fault
http://stackoverflow.com/questions/29092848/error-running-rails-server-on-os-10-10-2

結論から言うと、activesupportとかその周辺のバージョンが古かったみたい?な感じかと。

なので、

$ bundle update 

でGemを最新に更新したら、正常に動作しました。

$ rails console 
irb(main):002:0> Message.create! content: 'Hello world!'
   (0.0ms)  begin transaction
  SQL (0.7ms)  INSERT INTO "messages" ("content", "created_at", "updated_at") VALUES (?, ?, ?)  [["content", "Hello world!"], ["created_at", 2016-12-22 07:13:27 UTC], ["updated_at", 2016-12-22 07:13:27 UTC]]
   (2.5ms)  commit transaction
=> #<Message id: 1, content: "Hello world!", created_at: "2016-12-22 07:13:27", updated_at: "2016-12-22 07:13:27">

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2