ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:92715] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands
       [not found] <redmine.issue-15862.20190518161953@ruby-lang.org>
@ 2019-05-18 16:19 ` socrates.medina
  2019-05-19  0:12 ` [ruby-core:92719] " mame
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: socrates.medina @ 2019-05-18 16:19 UTC (permalink / raw)
  To: ruby-core

Issue #15862 has been reported by destrozates (Socrates Medina).

----------------------------------------
Bug #15862: Segmentation fault when running Rails commands
https://bugs.ruby-lang.org/issues/15862

* Author: destrozates (Socrates Medina)
* Status: Open
* 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´ve 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 managed 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 the 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
=> Booting Puma
=> Rails application starting on http://localhost:3000
=> Run `rails server -h` for more startup options
=> 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
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> 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=0
### System configuration

**Ruby version**: I´ve 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 from 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 reached 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 development 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-specific 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 encountered 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/ruby/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 wrong 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 bug over at FFI, attempt to recompile Ruby from source, test `inotify` on your distro outside of Ruby but you probably just want to get on with some development given you've been at it a few days.
> 
> I believe to fix this you can open `config/development.rb` and replace this:
> 
> ```ruby
>   # Use an evented file watcher to asynchronously detect changes in source code,
>   # routes, locales, etc. This feature depends on the listen gem.
>   config.file_watcher = ActiveSupport::EventedFileUpdateChecker
> ```
> 
> with 
> 
> ```ruby
>   # Use a simple file watcher to detect changes in source code
>   config.file_watcher = ActiveSupport::FileUpdateChecker
> ```
> 
> Caveat: The `EventedFileWatcher` is supposed to use OS events to detect file 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/1797#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 = 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´t 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:92719] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands
       [not found] <redmine.issue-15862.20190518161953@ruby-lang.org>
  2019-05-18 16:19 ` [ruby-core:92715] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands socrates.medina
@ 2019-05-19  0:12 ` mame
  2019-06-04 17:03 ` [ruby-core:92962] " socrates.medina
  2019-06-04 17:52 ` [ruby-core:92963] " merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2019-05-19  0:12 UTC (permalink / raw)
  To: ruby-core

Issue #15862 has been updated by mame (Yusuke Endoh).

Status changed from Open to Third Party's Issue

I think this issue is a bug or spec of rb-inotify.  If it is a bug, it should be fixed.  If it is a spec, rails should not use rb-inotify in such an environment.  Anyway, you have already filed a ticket in that bug tracker: https://github.com/guard/rb-inotify/issues/94.  Please want for the answer.

This tracker is for discussing a bug and feature of ruby itself.  I'm unsure what you want to discuss in this ticket.  I'm closing this as Third Party's Issue.  Let me know if you have any specific topic about ruby itself.

----------------------------------------
Bug #15862: Segmentation fault when running Rails commands
https://bugs.ruby-lang.org/issues/15862#change-78076

* 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´ve 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 managed 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 the 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
=> Booting Puma
=> Rails application starting on http://localhost:3000
=> Run `rails server -h` for more startup options
=> 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
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> 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=0
### System configuration

**Ruby version**: I´ve 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 from 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 reached 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 development 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-specific 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 encountered 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/ruby/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 wrong 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 bug over at FFI, attempt to recompile Ruby from source, test `inotify` on your distro outside of Ruby but you probably just want to get on with some development given you've been at it a few days.
> 
> I believe to fix this you can open `config/development.rb` and replace this:
> 
> ```ruby
>   # Use an evented file watcher to asynchronously detect changes in source code,
>   # routes, locales, etc. This feature depends on the listen gem.
>   config.file_watcher = ActiveSupport::EventedFileUpdateChecker
> ```
> 
> with 
> 
> ```ruby
>   # Use a simple file watcher to detect changes in source code
>   config.file_watcher = ActiveSupport::FileUpdateChecker
> ```
> 
> Caveat: The `EventedFileWatcher` is supposed to use OS events to detect file 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/1797#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 = 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´t 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:92962] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands
       [not found] <redmine.issue-15862.20190518161953@ruby-lang.org>
  2019-05-18 16:19 ` [ruby-core:92715] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands socrates.medina
  2019-05-19  0:12 ` [ruby-core:92719] " mame
@ 2019-06-04 17:03 ` socrates.medina
  2019-06-04 17:52 ` [ruby-core:92963] " merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: socrates.medina @ 2019-06-04 17:03 UTC (permalink / raw)
  To: ruby-core

Issue #15862 has been updated by destrozates (Socrates Medina).


mame (Yusuke Endoh) wrote:
> I think this issue is a bug or spec of rb-inotify.  If it is a bug, it should be fixed.  If it is a spec, rails should not use rb-inotify in such an environment.  Anyway, you have already filed a ticket in that bug tracker: https://github.com/guard/rb-inotify/issues/94.  Please want for the answer.
> 
> This tracker is for discussing a bug and feature of ruby itself.  I'm unsure what you want to discuss in this ticket.  I'm closing this as Third Party's Issue.  Let me know if you have any specific topic about ruby itself.

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?

----------------------------------------
Bug #15862: Segmentation fault when running Rails commands
https://bugs.ruby-lang.org/issues/15862#change-78340

* 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´ve 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 managed 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 the 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
=> Booting Puma
=> Rails application starting on http://localhost:3000
=> Run `rails server -h` for more startup options
=> 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
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> 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=0
### System configuration

**Ruby version**: I´ve 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 from 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 reached 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 development 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-specific 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 encountered 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/ruby/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 wrong 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 bug over at FFI, attempt to recompile Ruby from source, test `inotify` on your distro outside of Ruby but you probably just want to get on with some development given you've been at it a few days.
> 
> I believe to fix this you can open `config/development.rb` and replace this:
> 
> ```ruby
>   # Use an evented file watcher to asynchronously detect changes in source code,
>   # routes, locales, etc. This feature depends on the listen gem.
>   config.file_watcher = ActiveSupport::EventedFileUpdateChecker
> ```
> 
> with 
> 
> ```ruby
>   # Use a simple file watcher to detect changes in source code
>   config.file_watcher = ActiveSupport::FileUpdateChecker
> ```
> 
> Caveat: The `EventedFileWatcher` is supposed to use OS events to detect file 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/1797#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 = 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´t 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:92963] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands
       [not found] <redmine.issue-15862.20190518161953@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-06-04 17:03 ` [ruby-core:92962] " socrates.medina
@ 2019-06-04 17:52 ` merch-redmine
  3 siblings, 0 replies; 4+ messages in thread
From: merch-redmine @ 2019-06-04 17:52 UTC (permalink / raw)
  To: 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 reproduce the segmentation fault without using a C extension, or can provide example 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´ve 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 managed 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 the 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
=> Booting Puma
=> Rails application starting on http://localhost:3000
=> Run `rails server -h` for more startup options
=> 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
=> Booting Puma
=> Rails 5.2.3 application starting in development 
=> 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=0
### System configuration

**Ruby version**: I´ve 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 from 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 reached 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 development 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-specific 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 encountered 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/ruby/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 wrong 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 bug over at FFI, attempt to recompile Ruby from source, test `inotify` on your distro outside of Ruby but you probably just want to get on with some development given you've been at it a few days.
> 
> I believe to fix this you can open `config/development.rb` and replace this:
> 
> ```ruby
>   # Use an evented file watcher to asynchronously detect changes in source code,
>   # routes, locales, etc. This feature depends on the listen gem.
>   config.file_watcher = ActiveSupport::EventedFileUpdateChecker
> ```
> 
> with 
> 
> ```ruby
>   # Use a simple file watcher to detect changes in source code
>   config.file_watcher = ActiveSupport::FileUpdateChecker
> ```
> 
> Caveat: The `EventedFileWatcher` is supposed to use OS events to detect file 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/1797#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 = 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´t 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-04 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15862.20190518161953@ruby-lang.org>
2019-05-18 16:19 ` [ruby-core:92715] [Ruby trunk Bug#15862] Segmentation fault when running Rails commands socrates.medina
2019-05-19  0:12 ` [ruby-core:92719] " mame
2019-06-04 17:03 ` [ruby-core:92962] " socrates.medina
2019-06-04 17:52 ` [ruby-core:92963] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).