From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 401D41F462 for ; Tue, 4 Jun 2019 17:52:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 3E031120A49; Wed, 5 Jun 2019 02:52:31 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 625261209E6 for ; Wed, 5 Jun 2019 02:52:28 +0900 (JST) Received: by filter0124p3las1.sendgrid.net with SMTP id filter0124p3las1-18067-5CF6AFDD-12 2019-06-04 17:52:29.332161666 +0000 UTC m=+1650.535448455 Received: from herokuapp.com (unknown [52.23.244.33]) by ismtpd0029p1mdw1.sendgrid.net (SG) with ESMTP id u8SE_ybBRbajjJugkWi39A for ; Tue, 04 Jun 2019 17:52:29.153 +0000 (UTC) Date: Tue, 04 Jun 2019 17:52:29 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68440 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15862 X-Redmine-Issue-Author: destrozates X-Redmine-Sender: jeremyevans0 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIe2zodbPho7WaEnF500L5aAZKJfnsOUxmfoLju?= =?us-ascii?Q?Qujr2xmAbY01BFXV6rjnV2pteI3blKWdbM98yeU?= =?us-ascii?Q?pk+SHMjUtH7G3j8=2FXnFDZRCXzVLDierrIp4OB9T?= =?us-ascii?Q?lOdlqbGUHt81fDYPm0SwaDIf5zx9Gw+Ek1w=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92963 Subject: [ruby-core:92963] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #15862 has been updated by jeremyevans0 (Jeremy Evans). destrozates (Socrates Medina) wrote: > Thanks for your answer, and sorry for my late reply. I just wanted to be = sure that this is not a Ruby issue. Can we say that we are sure about that? We may not be 100% sure, but the segmentation fault happens in a function (= `inotify_init`) in a external C extension . It is far more likely to be an= issue with the `rb-inotify` gem than an issue in Ruby. If you can reprodu= ce the segmentation fault without using a C extension, or can provide examp= le C code that uses the Ruby C-API that reproduces the segmentation fault, = please open a new issue with example code. ---------------------------------------- Bug #15862: Segmentation fault when running Rails commands https://bugs.ruby-lang.org/issues/15862#change-78341 * Author: destrozates (Socrates Medina) * Status: Third Party's Issue * Priority: Normal * Assignee: = * Target version: = * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [armv7l-linux-eabihf] = and ruby 2.5.5p157 (2019-03-15 revision 67260) [armv7l-linux-eabihf] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- I=B4ve been trying to install rbenv, ruby and rails in my Raspberry Pi 3 B+= in the past couple of days and after some issues here and there, I've mana= ged to get everything installed with no errors With rbenv I installed both Ruby 2.6.3 and Ruby 2.5.5 Using Rails 5.2.3 and with both ruby versions I am getting the same problem when I execute th= e command: ``` rails server ``` ### Steps to reproduce 1) On a Raspberry Pi install rbenv using brew ``` brew install rbenv ``` 2) Then use the following command to install ruby ``` rbenv install 2.6.3 ``` = 3) Then install rails: ``` gem install rails -v 5.2.3 ``` 4) Create a new folder to hold your application and go to that folder: ``` $ cd # Change to the home directory. $ mkdir environment # Make a environment directory. $ cd environment/ # Change into the environment directory. ``` 5) Use rails to create the application inside the previous folder: ``` rails _5.2.3_ new hello_app ``` 6) Go to the recently created 'hello_app' folder ``` cd hello_app ``` 7) Start the rails server ``` rails server ``` ### Expected behavior ``` pi@raspberrypi:~/environment/hello_app $ rails server =3D> Booting Puma =3D> Rails application starting on http://localhost:3000 =3D> Run `rails server -h` for more startup options =3D> Ctrl-C to shutdown server ``` And then it should just stay there to be able to access the web app on the = address indicated ### Actual behavior First, the output shows this: ``` pi@raspberrypi:~/environment/hello_app $ rails server =3D> Booting Puma =3D> Rails 5.2.3 application starting in development = =3D> Run `rails server -h` for more startup options ``` And then the contents of the text file in the next link are shown. Here is a link with the whole output: https://www.dropbox.com/s/gjgo81zqeekfnvt/railsservererror.txt?dl=3D0 ### System configuration **Ruby version**: I=B4ve tried with both 2.6.3 and Ruby 2.5.5 **Rails version**: I've tried with 6.0.0.rc1 and with 5.2.3 **Puma version**: I've tried with 3.12.1 and a previous one too ### Workaround User @dannyfallon helped me with a workaround and explanation as follows f= rom the Puma github site because I thought this was an issue with the Puma = web server, but I was wrong: > According to your segfault's `Control frame information` you never even r= eached Puma. I would think that since Puma was never reached if you swapped= `puma` in your gemfile for `thin` or `webrick` you still wouldn't be able = to run `rails server`. = > = > When you run `rails server` the application does a bunch of stuff before = actually passing off the `Rails::Application` to a Rack server to run. In d= evelopment Rails creates an `EventedFileWatcher` to watch for file changes = so it can reload your app without you having to stop/start your server all = the time. This uses the `listen` gem, which under the hood uses some OS-spe= cific file events so it doesn't have to keep polling. In trying to create a= watch (which `listen` does through `rb-inotify` for Linux), Ruby encounter= ed a segmentation fault: > = > ``` > /home/pi/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/rb-inotify-0.10.0= /lib/rb-inotify/notifier.rb:57: [BUG] Segmentation fault at 0xe92d000e > ruby 2.5.5p157 (2019-03-15 revision 67260) [armv7l-linux-eabihf] > = > -- Control frame information --------------------------------------------= --- > c:0095 p:---- s:0527 e:000526 CFUNC :inotify_init > c:0094 p:0041 s:0523 e:000522 METHOD /home/pi/.rbenv/versions/2.5.5/lib/r= uby/gems/2.5.0/gems/rb-inotify-0.10.0/lib/rb-inotify/notifier.rb:57 [FINISH] > ``` > = > Because `rb-inotify` is using FFI and some C functions, when things go wr= ong it does tend to blow up badly with segmentation faults. > = > There's lots of stuff you can do if you want to go deeper like report a b= ug over at FFI, attempt to recompile Ruby from source, test `inotify` on yo= ur distro outside of Ruby but you probably just want to get on with some de= velopment given you've been at it a few days. > = > I believe to fix this you can open `config/development.rb` and replace th= is: > = > ```ruby > # Use an evented file watcher to asynchronously detect changes in sourc= e code, > # routes, locales, etc. This feature depends on the listen gem. > config.file_watcher =3D ActiveSupport::EventedFileUpdateChecker > ``` > = > with = > = > ```ruby > # Use a simple file watcher to detect changes in source code > config.file_watcher =3D ActiveSupport::FileUpdateChecker > ``` > = > Caveat: The `EventedFileWatcher` is supposed to use OS events to detect f= ile changes. The = > `FileWatcher` will poll for changes. This may slow down reloads or cause = higher system load. _Originally posted by @dannyfallon in https://github.com/puma/puma/issues/1= 797#issuecomment-493190148_ The solution proposed by @dannyfallon actually allowed me to start the Web= Server, but I was wondering if the people here at rb-inotify could give me= a hand to try to figure out what went wrong and if there is anything I can= do to fix this problem and be able to use ``` config.file_watcher =3D ActiveSupport::EventedFileUpdateChecker ``` Sorry for the long post... Awaiting your comments. P.S.: by the way, I get the same segmentation fault when I try to create a = new rails app with rails version 6.0.0.rc1: ``` rails _6.0.0.rc1_ new hello_app ``` but if I use version 5.2.3 I don=B4t get the error ``` rails _5.2.3_ new hello_app ``` I also get the segmentation fault when I try to execute the following rails= command: ``` rails generate scaffold User name:string email:string ``` Thanks, -- = https://bugs.ruby-lang.org/ Unsubscribe: