unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
@ 2021-03-29 19:06 vtamara
  2021-03-30  1:58 ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: vtamara @ 2021-03-29 19:06 UTC (permalink / raw)
  To: unicorn-public

Hi

Launching a rails application with Ruby 3, Unicorn 6 on OpenBSD/adJ 6.8, 
I'm
experiencing a lot of "Bus Error" and "Segmentation Faults" during 
aproximately half hour. Around the first 10 minutes the application is 
not accessible from a browser. After it is possible to use the 
application and after half hour it runs withouth errors.  Pasting below 
what appears in the log file after launching the application at 9:29AM 
and trying to use it at 9:30AM:

---------------------------------
% grep ERROR log/unicorn.log
E, [2021-03-29T09:30:03.442089 #41947] ERROR -- : reaped 
#<Process::Status: pid 76292 SIGBUS (signal 10) (core dumped)> worker=1
E, [2021-03-29T09:30:03.510420 #41947] ERROR -- : reaped 
#<Process::Status: pid 64220 SIGBUS (signal 10) (core dumped)> worker=0
E, [2021-03-29T09:30:18.142316 #41947] ERROR -- : reaped 
#<Process::Status: pid 92400 SIGBUS (signal 10) (core dumped)> worker=1
E, [2021-03-29T09:30:18.479996 #41947] ERROR -- : reaped 
#<Process::Status: pid 91828 SIGSEGV (signal 11) (core dumped)> worker=0
E, [2021-03-29T09:30:31.009344 #41947] ERROR -- : reaped 
#<Process::Status: pid 69666 SIGBUS (signal 10) (core dumped)> worker=1
E, [2021-03-29T09:30:31.773215 #41947] ERROR -- : reaped 
#<Process::Status: pid 932 SIGBUS (signal 10) (core dumped)> worker=0
E, [2021-03-29T09:30:41.854087 #41947] ERROR -- : reaped 
#<Process::Status: pid 89615 SIGBUS (signal 10) (core dumped)> worker=1
E, [2021-03-29T09:30:43.806074 #41947] ERROR -- : reaped 
#<Process::Status: pid 85832 SIGBUS (signal 10) (core dumped)> worker=0
E, [2021-03-29T09:30:51.204133 #41947] ERROR -- : reaped 
#<Process::Status: pid 22197 SIGBUS (signal 10) (core dumped)> worker=1
E, [2021-03-29T09:30:54.411162 #41947] ERROR -- : reaped 
#<Process::Status: pid 41441 SIGBUS (signal 10) (core dumped)> worker=0
...
---------------------------------

It failed 175 times between 9:30 and 9:56 (around 7 times per minute).

I'm pasting below details of the first errors (the others are very 
similar):

---------------------------------
I, [2021-03-29T09:29:43.080073 #41947]  INFO -- : listening on 
addr=0.0.0.0:2023 fd=12
I, [2021-03-29T09:29:43.080590 #41947]  INFO -- : worker=0 spawning...
I, [2021-03-29T09:29:43.085933 #41947]  INFO -- : worker=1 spawning...
I, [2021-03-29T09:29:43.092779 #41947]  INFO -- : master process ready
I, [2021-03-29T09:29:43.097320 #64220]  INFO -- : worker=0 spawned 
pid=64220
I, [2021-03-29T09:29:43.099608 #64220]  INFO -- : Refreshing Gem list
I, [2021-03-29T09:29:43.098921 #76292]  INFO -- : worker=1 spawned 
pid=76292
I, [2021-03-29T09:29:43.101231 #76292]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Bus Error at 0x000003cb54021715
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]

-- Control frame information 
-----------------------------------------------
E, [2021-03-29T09:30:03.442089 #41947] ERROR -- : reaped 
#<Process::Status: pid 76292 SIGBUS (signal 10) (core dumped)> worker=1
I, [2021-03-29T09:30:03.442265 #41947]  INFO -- : worker=1 spawning...
I, [2021-03-29T09:30:03.450867 #92400]  INFO -- : worker=1 spawned 
pid=92400
I, [2021-03-29T09:30:03.451758 #92400]  INFO -- : Refreshing Gem list
E, [2021-03-29T09:30:03.510420 #41947] ERROR -- : reaped 
#<Process::Status: pid 64220 SIGBUS (signal 10) (core dumped)> worker=0
I, [2021-03-29T09:30:03.510651 #41947]  INFO -- : worker=0 spawning...
I, [2021-03-29T09:30:03.519324 #91828]  INFO -- : worker=0 spawned 
pid=91828
I, [2021-03-29T09:30:03.520401 #91828]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Bus Error at 0x000003cb5402178a
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]

-- Control frame information 
-----------------------------------------------
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Segmentation fault at 0x0000002100100001
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]

-- Control frame information 
-----------------------------------------------
E, [2021-03-29T09:30:18.142316 #41947] ERROR -- : reaped 
#<Process::Status: pid 92400 SIGBUS (signal 10) (core dumped)> worker=1
I, [2021-03-29T09:30:18.142690 #41947]  INFO -- : worker=1 spawning...
I, [2021-03-29T09:30:18.151973 #69666]  INFO -- : worker=1 spawned 
pid=69666
I, [2021-03-29T09:30:18.152831 #69666]  INFO -- : Refreshing Gem list
E, [2021-03-29T09:30:18.479996 #41947] ERROR -- : reaped 
#<Process::Status: pid 91828 SIGSEGV (signal 11) (core dumped)> worker=0
I, [2021-03-29T09:30:18.480196 #41947]  INFO -- : worker=0 spawning...
I, [2021-03-29T09:30:18.488551 #932]  INFO -- : worker=0 spawned pid=932
I, [2021-03-29T09:30:18.489657 #932]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Bus Error at 0x000003cb5402178a
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]

-- Control frame information 
-----------------------------------------------
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Bus Error at 0x000003cb54021715
...

----------------------------------------

The line 80 of the file 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb is:

case ENV["RACK_ENV"]

Only 4 errors had a backtrace, pasting the first one:

----------------------------------------
I, [2021-03-29T09:34:31.278771 #37959]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Segmentation fault at 0x0000000000000019
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]

-- Control frame information 
-----------------------------------------------
c:0027 p:0168 s:0177 e:000174 BLOCK  
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80
c:0026 p:0040 s:0167 e:000166 BLOCK  
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/bin/unicorn_rails:139
c:0025 p:0098 s:0160 e:000157 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:826
c:0024 p:0180 s:0154 E:001988 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:690
c:0023 p:0010 s:0147 e:000146 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:712
c:0022 p:0122 s:0132 e:000131 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:547
c:0021 p:0030 s:0124 e:000123 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:561
c:0020 p:0205 s:0119 e:000118 METHOD 
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:294
c:0019 p:0230 s:0111 E:001550 TOP    
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/bin/unicorn_rails:209 
[FINISH]
c:0018 p:---- s:0104 e:000103 CFUNC  :load
c:0017 p:0112 s:0099 e:000098 TOP    /usr/local/bin/unicorn_rails:23 
[FINISH]
c:0016 p:---- s:0094 e:000093 CFUNC  :load
c:0015 p:0107 s:0089 e:000088 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63
c:0014 p:0071 s:0083 e:000082 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:28
c:0013 p:0024 s:0078 e:000077 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:494
c:0012 p:0054 s:0073 e:000072 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27
c:0011 p:0040 s:0065 e:000064 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127
c:0010 p:0239 s:0058 e:000057 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392
c:0009 p:0008 s:0045 e:000044 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:30
c:0008 p:0066 s:0040 e:000039 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485
c:0007 p:0008 s:0033 e:000032 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:24
c:0006 p:0109 s:0028 e:000027 BLOCK  
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/exe/bundle:49
c:0005 p:0014 s:0022 e:000021 METHOD 
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130
c:0004 p:0162 s:0017 E:001778 TOP    
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/exe/bundle:37 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0112 s:0008 E:001580 EVAL   /usr/local/bin/bundle:23 [FINISH]
c:0001 p:0000 s:0003 E:000740 (none) [FINISH]

-- Ruby level backtrace information 
----------------------------------------
/usr/local/bin/bundle:23:in `<main>'
/usr/local/bin/bundle:23:in `load'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/exe/bundle:37:in `<top 
(required)>'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130:in 
`with_friendly_errors'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/exe/bundle:49:in `block 
in <top (required)>'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:24:in 
`start'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in 
`start'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:30:in 
`dispatch'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392:in 
`dispatch'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in 
`invoke_command'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in 
`run'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli.rb:494:in 
`exec'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:28:in 
`run'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in 
`kernel_load'
/usr/local/lib/ruby/gems/3.0/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in 
`load'
/usr/local/bin/unicorn_rails:23:in `<top (required)>'
/usr/local/bin/unicorn_rails:23:in `load'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/bin/unicorn_rails:209:in 
`<top (required)>'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:294:in 
`join'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:561:in 
`maintain_worker_count'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:547:in 
`spawn_missing_workers'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:712:in 
`worker_loop'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:690:in 
`init_worker_process'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn/http_server.rb:826:in 
`build_app!'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/bin/unicorn_rails:139:in 
`block in rails_builder'
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80:in `block 
in builder'

-- Other runtime information 
-----------------------------------------------

* Loaded script: unicorn_rails worker[0] -c 
/var/www/htdocs/sivel2/config/unicorn.conf.minimal.rb -E production -D

* Loaded features:

     0 enumerator.so
     1 thread.rb
     2 rational.so
     3 complex.so
     4 ruby2_keywords.rb
     5 /usr/local/lib/ruby/3.0/x86_64-openbsd/enc/encdb.so
     6 /usr/local/lib/ruby/3.0/x86_64-openbsd/enc/trans/transdb.so
     7 /usr/local/lib/ruby/3.0/x86_64-openbsd/rbconfig.rb
     8 /usr/local/lib/ruby/site_ruby/3.0/rubygems/compatibility.rb
     9 /usr/local/lib/ruby/site_ruby/3.0/rubygems/defaults.rb
    10 /usr/local/lib/ruby/site_ruby/3.0/rubygems/deprecate.rb
    11 /usr/local/lib/ruby/site_ruby/3.0/rubygems/errors.rb
    12 /usr/local/lib/ruby/site_ruby/3.0/rubygems/exceptions.rb
    13 /usr/local/lib/ruby/site_ruby/3.0/rubygems/basic_specification.rb
    14 /usr/local/lib/ruby/site_ruby/3.0/rubygems/stub_specification.rb
    15 /usr/local/lib/ruby/site_ruby/3.0/rubygems/text.rb
    16 /usr/local/lib/ruby/site_ruby/3.0/rubygems/user_interaction.rb
    17 /usr/local/lib/ruby/site_ruby/3.0/rubygems/specification_policy.rb
    18 /usr/local/lib/ruby/site_ruby/3.0/rubygems/util/list.rb
    19 /usr/local/lib/ruby/site_ruby/3.0/rubygems/platform.rb
    20 /usr/local/lib/ruby/site_ruby/3.0/rubygems/version.rb
    21 /usr/local/lib/ruby/site_ruby/3.0/rubygems/requirement.rb
    22 /usr/local/lib/ruby/site_ruby/3.0/rubygems/specification.rb
    23 /usr/local/lib/ruby/site_ruby/3.0/rubygems/util.rb
    24 /usr/local/lib/ruby/site_ruby/3.0/rubygems/dependency.rb
...
  2937 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/server/connections.rb
  2938 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/server/configuration.rb
  2939 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/server/worker/active_record_connection_management.rb
  2940 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/server/worker.rb
  2941 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel.rb
  2942 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/callbacks.rb
  2943 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/periodic_timers.rb
  2944 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/streams.rb
  2945 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/naming.rb
  2946 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/broadcasting.rb
  2947 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/channel/base.rb
  2948 
/var/www/bundler/ruby/3.0/gems/actioncable-6.1.3.1/lib/action_cable/server/base.rb
  2949 /var/www/htdocs/sivel2/config/environment.rb

----------------------------------------


Blessings

-- 
Dios, gracias por tu amor infinito.
--
   Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
   http://www.pasosdejesus.org/dominio_publico_colombia.html

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
  2021-03-29 19:06 Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0 vtamara
@ 2021-03-30  1:58 ` Eric Wong
  2021-03-30  4:00   ` Jeremy Evans
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2021-03-30  1:58 UTC (permalink / raw)
  To: vtamara; +Cc: unicorn-public, Jeremy Evans

vtamara <vtamara@pasosdeJesus.org> wrote:
> Hi
> 
> Launching a rails application with Ruby 3, Unicorn 6 on OpenBSD/adJ 6.8, I'm
> experiencing a lot of "Bus Error" and "Segmentation Faults" during
> aproximately half hour.

+Cc: Jeremy Evans, who is more familiar with OpenBSD and Ruby 3.0 than I
cf. https://yhbt.net/unicorn-public/6acb1c84c7392d7b4a64572b20498549@pasosdeJesus.org/

vtamara: did previous versions of Ruby, unicorn, or OpenBSD work
for your app?

Is preload_app in use?  If so, does the problem manifest without
preload_app?

Are you using Ractor or any other new/experimental stuff
in Ruby?

Can you reproduce the problem with a simple "hello world"-style app?

> The line 80 of the file
> /var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb is:
> 
> case ENV["RACK_ENV"]
> 
> Only 4 errors had a backtrace, pasting the first one:
> 
> ----------------------------------------
> I, [2021-03-29T09:34:31.278771 #37959]  INFO -- : Refreshing Gem list
> /var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG]
> Segmentation fault at 0x0000000000000019

That's a strange one, I wonder if OpenBSD getenv(3) has some
restrictions or other odd behaviors with it?

Do you have any code/dependencies which are calling "ENV#[]=" in
Ruby; setenv()/putenv() in C, or modifying "environ" directly
in C?

Especially in sub-threads/Ractors at startup...

<snip>

> * Loaded features:
> 
>     0 enumerator.so
>     1 thread.rb
>     2 rational.so
>     3 complex.so
>     4 ruby2_keywords.rb
>     5 /usr/local/lib/ruby/3.0/x86_64-openbsd/enc/encdb.so
>     6 /usr/local/lib/ruby/3.0/x86_64-openbsd/enc/trans/transdb.so

<snip>

> ...

Any other .so extensions?  C extensions can do any number of
things and maybe some interact badly...

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
  2021-03-30  1:58 ` Eric Wong
@ 2021-03-30  4:00   ` Jeremy Evans
  2021-04-04 11:06     ` vtamara
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Evans @ 2021-03-30  4:00 UTC (permalink / raw)
  To: Eric Wong; +Cc: vtamara, unicorn-public

On 03/30 01:58, Eric Wong wrote:
> vtamara <vtamara@pasosdeJesus.org> wrote:
> > Hi
> > 
> > Launching a rails application with Ruby 3, Unicorn 6 on OpenBSD/adJ 6.8, I'm
> > experiencing a lot of "Bus Error" and "Segmentation Faults" during
> > aproximately half hour.
> 
> +Cc: Jeremy Evans, who is more familiar with OpenBSD and Ruby 3.0 than I
> cf. https://yhbt.net/unicorn-public/6acb1c84c7392d7b4a64572b20498549@pasosdeJesus.org/

I'll be happy to look into this if a minimal self-contained reproducible
example is posted.  Personally, I run my Ruby apps on OpenBSD amd64 with
Unicorn, and haven't seen similar errors.  However, I don't use
preload_app and use fairly minimal dependencies.

Thanks,
Jeremy

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
  2021-03-30  4:00   ` Jeremy Evans
@ 2021-04-04 11:06     ` vtamara
  2021-04-04 16:43       ` Jeremy Evans
  0 siblings, 1 reply; 9+ messages in thread
From: vtamara @ 2021-04-04 11:06 UTC (permalink / raw)
  To: Jeremy Evans; +Cc: Eric Wong, unicorn-public

Hi

Thank you very much for the reply and the interest in helping.

> vtamara: did previous versions of Ruby, unicorn, or OpenBSD work
> for your app?

The application was working withouth issue on OpenBSD/adJ amd64 6.7, 
ruby 2.7 and unicorn 6.0.  So there is something in conflict betweeen 
Unicorn 6.0 with OpenBSD/adJ 6.8 and ruby 3.0.

> Is preload_app in use?  If so, does the problem manifest without
> preload_app?

No

> Are you using Ractor or any other new/experimental stuff
> in Ruby?

No

> Can you reproduce the problem with a simple "hello world"-style app?

I don't have a hello world example at hand, but some projects that 
present this problem when I run them on OpenBSD/adJ amd64 6.8, nginx 
1.18.0, node 12.16.1, PostgreSQL 13.2, Ruby 3.0, Rails 6.1 and Unicorn 
6.0 are:

https://github.com/pasosdeJesus/cor1440
https://github.com/pasosdeJesus/cor1440_pdJ
https://github.com/pasosdeJesus/sivel2
https://github.com/pasosdeJesus/si_anzorc
https://github.com/pasosdeJesus/si_asom
https://github.com/pasosdeJesus/si_codacop
https://github.com/pasosdeJesus/sivel2_mujeresindigenas/

The simplest of them is https://github.com/pasosdeJesus/cor1440, althoug 
it requires:
* PostgreSQL
* nginx
* nodejs
* yarn. I install it with: doas pkg_add bash; ftp -o- 
https://yarnpkg.com/install.sh | bash
* A directory /var/www/bundler/ruby/3.0 where I install the gems with 
the permissions of a user (not root) that runs the application, and 
better running:
   bundle config path /var/www/bundler/.
* unicorn installed globally with:
   doas gem install unicorn
   doas ln -s /usr/local/bin/unicorn_rails30 /usr/local/bin/unicorn

To create the PostgreSQL user (in the following example sipdes) and a 
database for the production environment  (in the following example 
cor1440gen_pro):

   doas su - _postgresql
   createuser -h /var/www/var/run/postgresql/ -U postgres -s sipdes
   createdb -h /var/www/var/run/postgresql/ -U postgres -O sipdes 
cor1440gen_pro
   psql -h /var/www/var/run/postgresql/ -U postgres
   postgres=# alter user sipdes with password 'xyz';
   postgres=# \q
   exit

With nginx suppossng I will run the application in localhost over SSL, 
what I do is to choose an unused port (let's say 2009) and add to the 
/etc/nginx/nginx.conf configuration in its http block:

  upstream unicorncor1440 {
	  server 127.0.0.1:2009 fail_timeout=0;
   }

I also add a server block inside the http block with:

   server {
       listen 443 ssl;
       ssl_certificate /etc/ssl/server.crt;
       ssl_certificate_key /etc/ssl/private/server.key;
       root /var/www/htdocs/cor1440/;
       server_name 127.0.0.1;
       error_log logs/cor1440.rror.log;

       location /cor1440 {
         try_files $uri @unicorncor1440;
       }

       location @unicorncor1440 {
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header Host $http_host;
         proxy_redirect off;
         proxy_pass http://unicorncor1440;
         error_page 500 502 503 504 /500.html;
         keepalive_timeout 10;
       }

       location ^~ /cor1440/assets/ {
         gzip_static on;
         expires max;
         add_header Cache-Control public;
         root /var/www/htdocs/cor1440/public/;
       }

       location ^~ /cor1440/images/ {
         gzip_static on;
         expires max;
         add_header Cache-Control public;
         root /var/www/htdocs/cor1440/public/;
       }

       location ^~ /cor1440/packs/ {
         gzip_static on;
         add_header Cache-Control public;
         root /var/www/htdocs/cor1440/public/;
       }
     }

And restarted nginx:

   doas rcctl restart nginx

Then to configure:

   cd /tmp
   git clone git@github.com:pasosdeJesus/cor1440
   doas mv cor1440 /var/www/htdocs/
   doas chown -R $USER:$USER /var/www/htdocs/cor1440
   cd /var/www/htdocs/cor1440
   mkdir .bundle
   echo '---' > .bundle/config
   echo 'BUNDLE_PATH: "/var/www/bundler"' >> .bundle/config
   echo 'BUNDLE_DISABLE_SHARED_GEMS: "true"' >> .bundle/config
   bundle

Here some gems will require installing with special permissions for 
example:

   doas gem install --install-dir /var/www/bundler/ruby/3.0 unicorn

Other gems that will require this kind of installation will be:
   racc nio4r websocket-driver bcrypt bindex msgpack ffi redcarpet kgio 
libxml-ruby pg
   nokogiri bootsnap puma sassc

Once bundle runs completely:

   cp .env.plantilla .env
   vi .env

There I set the variables:
* BD_USUARIO with the database user,
* BD_CLAVE with the password
* BD_PRO with the name of the production database
* CONFIG_HOSTS=127.0.0.1
* DIRAP with the path to the application
* RAILS_ENV=production
* PUERTOUNICORN with the port I choosed and set in nginx.conf
* USUARIO_AP with the operating system user who will run the application

Prepare credentials and database:

   bin/rails credentials:edit
   RAILS_ENV=production bin/rails credentials:edit
   bin/railsp db:setup  db:migrate sip:indices

Precompile assets:

   CXX=c++ yarn
   doas ln -s /usr/local/bin/node /tmp  # To overcome bug of node with 
rails on OpenBSD
   bin/railsp assets:precompile

Run the application with:
   SECRET_KEY_BASE=cf46 DIRAP=/var/www/htdocs/cor1440/ bin/u.sh

Trying to see the application running with a browser in 
https://127.0.0.1/cor1440 will produce the errors described in 
log/unicorn.log.

Blessings. Thank you.

El 2021-03-30 00:00, Jeremy Evans escribió:
> On 03/30 01:58, Eric Wong wrote:
>> vtamara <vtamara@pasosdeJesus.org> wrote:
>> > Hi
>> >
>> > Launching a rails application with Ruby 3, Unicorn 6 on OpenBSD/adJ 6.8, I'm
>> > experiencing a lot of "Bus Error" and "Segmentation Faults" during
>> > aproximately half hour.
>> 
>> +Cc: Jeremy Evans, who is more familiar with OpenBSD and Ruby 3.0 than 
>> I
>> cf. 
>> https://yhbt.net/unicorn-public/6acb1c84c7392d7b4a64572b20498549@pasosdeJesus.org/
> 
> I'll be happy to look into this if a minimal self-contained 
> reproducible
> example is posted.  Personally, I run my Ruby apps on OpenBSD amd64 
> with
> Unicorn, and haven't seen similar errors.  However, I don't use
> preload_app and use fairly minimal dependencies.
> 
> Thanks,
> Jeremy

-- 
Dios, gracias por tu amor infinito.
--
   Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
   http://www.pasosdejesus.org/dominio_publico_colombia.html

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
  2021-04-04 11:06     ` vtamara
@ 2021-04-04 16:43       ` Jeremy Evans
  2021-04-04 20:03         ` Eric Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Evans @ 2021-04-04 16:43 UTC (permalink / raw)
  To: vtamara; +Cc: Eric Wong, unicorn-public

On 04/04 07:06, vtamara wrote:
> Hi
> 
> Thank you very much for the reply and the interest in helping.
> 
> > vtamara: did previous versions of Ruby, unicorn, or OpenBSD work
> > for your app?
> 
> The application was working withouth issue on OpenBSD/adJ amd64 6.7, ruby
> 2.7 and unicorn 6.0.  So there is something in conflict betweeen Unicorn 6.0
> with OpenBSD/adJ 6.8 and ruby 3.0.
> 
> > Is preload_app in use?  If so, does the problem manifest without
> > preload_app?
> 
> No
> 
> > Are you using Ractor or any other new/experimental stuff
> > in Ruby?
> 
> No
> 
> > Can you reproduce the problem with a simple "hello world"-style app?
> 
> I don't have a hello world example at hand, but some projects that present
> this problem when I run them on OpenBSD/adJ amd64 6.8, nginx 1.18.0, node
> 12.16.1, PostgreSQL 13.2, Ruby 3.0, Rails 6.1 and Unicorn 6.0 are:
> 
> https://github.com/pasosdeJesus/cor1440
> https://github.com/pasosdeJesus/cor1440_pdJ
> https://github.com/pasosdeJesus/sivel2
> https://github.com/pasosdeJesus/si_anzorc
> https://github.com/pasosdeJesus/si_asom
> https://github.com/pasosdeJesus/si_codacop
> https://github.com/pasosdeJesus/sivel2_mujeresindigenas/

Unfortunately, given the required amount of setup, I don't think I'll
have time to look into this.  The best way to debug this is to start
removing code/dependencies piece by piece until the problem goes away.
Once the problem goes away, add that code back, and make sure it fails
again, then start removing other code/dependencies.  Repeat this process
until you have the most minimal example, where removing any additional
code/dependencies will stop the code from failing.

Sorry,
Jeremy

> 
> The simplest of them is https://github.com/pasosdeJesus/cor1440, althoug it
> requires:
> * PostgreSQL
> * nginx
> * nodejs
> * yarn. I install it with: doas pkg_add bash; ftp -o-
> https://yarnpkg.com/install.sh | bash
> * A directory /var/www/bundler/ruby/3.0 where I install the gems with the
> permissions of a user (not root) that runs the application, and better
> running:
>   bundle config path /var/www/bundler/.
> * unicorn installed globally with:
>   doas gem install unicorn
>   doas ln -s /usr/local/bin/unicorn_rails30 /usr/local/bin/unicorn
> 
> To create the PostgreSQL user (in the following example sipdes) and a
> database for the production environment  (in the following example
> cor1440gen_pro):
> 
>   doas su - _postgresql
>   createuser -h /var/www/var/run/postgresql/ -U postgres -s sipdes
>   createdb -h /var/www/var/run/postgresql/ -U postgres -O sipdes
> cor1440gen_pro
>   psql -h /var/www/var/run/postgresql/ -U postgres
>   postgres=# alter user sipdes with password 'xyz';
>   postgres=# \q
>   exit
> 
> With nginx suppossng I will run the application in localhost over SSL, what
> I do is to choose an unused port (let's say 2009) and add to the
> /etc/nginx/nginx.conf configuration in its http block:
> 
>  upstream unicorncor1440 {
> 	  server 127.0.0.1:2009 fail_timeout=0;
>   }
> 
> I also add a server block inside the http block with:
> 
>   server {
>       listen 443 ssl;
>       ssl_certificate /etc/ssl/server.crt;
>       ssl_certificate_key /etc/ssl/private/server.key;
>       root /var/www/htdocs/cor1440/;
>       server_name 127.0.0.1;
>       error_log logs/cor1440.rror.log;
> 
>       location /cor1440 {
>         try_files $uri @unicorncor1440;
>       }
> 
>       location @unicorncor1440 {
>         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>         proxy_set_header X-Forwarded-Proto $scheme;
>         proxy_set_header Host $http_host;
>         proxy_redirect off;
>         proxy_pass http://unicorncor1440;
>         error_page 500 502 503 504 /500.html;
>         keepalive_timeout 10;
>       }
> 
>       location ^~ /cor1440/assets/ {
>         gzip_static on;
>         expires max;
>         add_header Cache-Control public;
>         root /var/www/htdocs/cor1440/public/;
>       }
> 
>       location ^~ /cor1440/images/ {
>         gzip_static on;
>         expires max;
>         add_header Cache-Control public;
>         root /var/www/htdocs/cor1440/public/;
>       }
> 
>       location ^~ /cor1440/packs/ {
>         gzip_static on;
>         add_header Cache-Control public;
>         root /var/www/htdocs/cor1440/public/;
>       }
>     }
> 
> And restarted nginx:
> 
>   doas rcctl restart nginx
> 
> Then to configure:
> 
>   cd /tmp
>   git clone git@github.com:pasosdeJesus/cor1440
>   doas mv cor1440 /var/www/htdocs/
>   doas chown -R $USER:$USER /var/www/htdocs/cor1440
>   cd /var/www/htdocs/cor1440
>   mkdir .bundle
>   echo '---' > .bundle/config
>   echo 'BUNDLE_PATH: "/var/www/bundler"' >> .bundle/config
>   echo 'BUNDLE_DISABLE_SHARED_GEMS: "true"' >> .bundle/config
>   bundle
> 
> Here some gems will require installing with special permissions for example:
> 
>   doas gem install --install-dir /var/www/bundler/ruby/3.0 unicorn
> 
> Other gems that will require this kind of installation will be:
>   racc nio4r websocket-driver bcrypt bindex msgpack ffi redcarpet kgio
> libxml-ruby pg
>   nokogiri bootsnap puma sassc
> 
> Once bundle runs completely:
> 
>   cp .env.plantilla .env
>   vi .env
> 
> There I set the variables:
> * BD_USUARIO with the database user,
> * BD_CLAVE with the password
> * BD_PRO with the name of the production database
> * CONFIG_HOSTS=127.0.0.1
> * DIRAP with the path to the application
> * RAILS_ENV=production
> * PUERTOUNICORN with the port I choosed and set in nginx.conf
> * USUARIO_AP with the operating system user who will run the application
> 
> Prepare credentials and database:
> 
>   bin/rails credentials:edit
>   RAILS_ENV=production bin/rails credentials:edit
>   bin/railsp db:setup  db:migrate sip:indices
> 
> Precompile assets:
> 
>   CXX=c++ yarn
>   doas ln -s /usr/local/bin/node /tmp  # To overcome bug of node with rails
> on OpenBSD
>   bin/railsp assets:precompile
> 
> Run the application with:
>   SECRET_KEY_BASE=cf46 DIRAP=/var/www/htdocs/cor1440/ bin/u.sh
> 
> Trying to see the application running with a browser in
> https://127.0.0.1/cor1440 will produce the errors described in
> log/unicorn.log.
> 
> Blessings. Thank you.
> 
> El 2021-03-30 00:00, Jeremy Evans escribi??:
> > On 03/30 01:58, Eric Wong wrote:
> > > vtamara <vtamara@pasosdeJesus.org> wrote:
> > > > Hi
> > > >
> > > > Launching a rails application with Ruby 3, Unicorn 6 on OpenBSD/adJ 6.8, I'm
> > > > experiencing a lot of "Bus Error" and "Segmentation Faults" during
> > > > aproximately half hour.
> > > 
> > > +Cc: Jeremy Evans, who is more familiar with OpenBSD and Ruby 3.0
> > > than I
> > > cf. https://yhbt.net/unicorn-public/6acb1c84c7392d7b4a64572b20498549@pasosdeJesus.org/
> > 
> > I'll be happy to look into this if a minimal self-contained reproducible
> > example is posted.  Personally, I run my Ruby apps on OpenBSD amd64 with
> > Unicorn, and haven't seen similar errors.  However, I don't use
> > preload_app and use fairly minimal dependencies.
> > 
> > Thanks,
> > Jeremy
> 
> -- 
> Dios, gracias por tu amor infinito.
> --
>   Vladimir T??mara Pati??o.  http://vtamara.pasosdeJesus.org/
>   http://www.pasosdejesus.org/dominio_publico_colombia.html

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0
  2021-04-04 16:43       ` Jeremy Evans
@ 2021-04-04 20:03         ` Eric Wong
  2021-04-07 21:19           ` Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application vtamara
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wong @ 2021-04-04 20:03 UTC (permalink / raw)
  To: vtamara; +Cc: Jeremy Evans, unicorn-public

Jeremy Evans <code@jeremyevans.net> wrote:
> Unfortunately, given the required amount of setup, I don't think I'll
> have time to look into this.  The best way to debug this is to start
> removing code/dependencies piece by piece until the problem goes away.
> Once the problem goes away, add that code back, and make sure it fails
> again, then start removing other code/dependencies.  Repeat this process
> until you have the most minimal example, where removing any additional
> code/dependencies will stop the code from failing.

The above is exactly what I would do, too.

I would also try to correlate the time of Bus Errors with logs
of when + which requests are failing, and try replaying only
those requests to narrow things down.

Also, do you have core dumps enabled?  Enable those
("ulimit -c unlimited" in sh), and run gdb on them as you get
them.  The .gdbinit in the source tree of the Ruby version
you're using is helpful not just for Ruby itself, but
also C extensions, too.  I'm no a gdb expert, but it's
well-documented and has built-in help.

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

* Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application
  2021-04-04 20:03         ` Eric Wong
@ 2021-04-07 21:19           ` vtamara
  2021-04-08  2:11             ` Jeremy Evans
  0 siblings, 1 reply; 9+ messages in thread
From: vtamara @ 2021-04-07 21:19 UTC (permalink / raw)
  To: Eric Wong; +Cc: Jeremy Evans, unicorn-public, ports

Good evening

I found that the problem happens also:

1. In OpenBSD-current (what will be 6.9 soon) --for that reason I copy 
to ports-openbsd
2. With what I consider the minimal rails application,  started with the 
flag --minimal, running with sqlite, i.e:

rails new --minimal ap61

The configuration of gems in /var/www/bundler and the configuration of 
nginx is as I explained in the previous email  
https://yhbt.net/unicorn-public/20210404200358.GA32719@dcvr/T/#mcf469c2eb443db6c9e4fee55afa3b252606c27f2 
but  changing cor1440 with ap61.

In my previous email I forgot some details, like how to create self 
signed certificate and how to install nginx and ruby, here they go:

doas pkg_add nginx
doas pkg_add ruby-3.0.0p0
  ln -sf /usr/local/bin/ruby30 /usr/local/bin/ruby
  ln -sf /usr/local/bin/erb30 /usr/local/bin/erb
  ln -sf /usr/local/bin/irb30 /usr/local/bin/irb
  ln -sf /usr/local/bin/rdoc30 /usr/local/bin/racc
  ln -sf /usr/local/bin/rdoc30 /usr/local/bin/rdoc
  ln -sf /usr/local/bin/rdoc30 /usr/local/bin/rbs
  ln -sf /usr/local/bin/ri30 /usr/local/bin/ri
  ln -sf /usr/local/bin/rake30 /usr/local/bin/rake
  ln -sf /usr/local/bin/gem30 /usr/local/bin/gem
  ln -sf /usr/local/bin/bundle30 /usr/local/bin/bundle
  ln -sf /usr/local/bin/bundler30 /usr/local/bin/bundler
  ln -sf /usr/local/bin/typeprof30 /usr/local/bin/typeprof


# Creating self signed certificate
doas openssl genrsa -out /etc/ssl/private/server.key 2048
openssl req -new -key /etc/ssl/private/server.key \
   -out /etc/ssl/private/server.csr
openssl x509 -req -days 3650 -in /etc/ssl/private/server.csr \
   -signkey /etc/ssl/private/server.key -out /etc/ssl/server.crt

# Installing sqlite3
doas pkg_add sqlite3
doas gem install --install-dir /var/www/bundler/ruby/3.0/ sqlite3

# Installing rails globally
doas gem install rails
doas ln -s /usr/local/bin/rails30 /usr/local/bin/rails

rails new --minimal ap61
mv ap61 /var/www/htdocs/
cd /var/www/htdocs/ap61

# Configuring unicorn
cat <<EOF >> Gemfile
group :production do
   gem 'unicorn'
end
EOF
doas gem install --install-dir /var/www/bundler/ruby/3.0 unicorn
bundle
cat <<EOF > config/unicorn.rb
listen 2011
APP_PATH="/var/www/htdocs/ap61"
working_directory APP_PATH
worker_processes 2
pid APP_PATH + "/tmp/pids/unicorn.pid"
stderr_path APP_PATH + "/log/unicorn.log"
stdout_path APP_PATH + "/log/unicorn.log"
EOF

# Start the application
bundle exec /usr/local/bin/unicorn_rails -c config/unicorn.rb -E 
production -D


# Try to see the initial rails screen
doas pkg_add w3m
w3m https://127.0.0.1/ap61

It will not present the presentation screen, stopping w3m and checking 
the logfile I see the samen Segmentation faults:

I, [2021-04-07T15:27:34.289298 #75098]  INFO -- : listening on 
addr=0.0.0.0:2011 fd=12
I, [2021-04-07T15:27:34.290752 #75098]  INFO -- : worker=0 spawning...
I, [2021-04-07T15:27:34.303205 #75098]  INFO -- : worker=1 spawning...
I, [2021-04-07T15:27:34.308574 #98078]  INFO -- : worker=0 spawned 
pid=98078
I, [2021-04-07T15:27:34.310157 #98078]  INFO -- : Refreshing Gem list
I, [2021-04-07T15:27:34.329730 #75098]  INFO -- : master process ready
I, [2021-04-07T15:27:34.390398 #14713]  INFO -- : worker=1 spawned 
pid=14713
I, [2021-04-07T15:27:34.391984 #14713]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:86: [BUG] 
Segmentation fault at 0x0000000000000000
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]



-- Control frame information 
-----------------------------------------------
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Segmentation fault at 0x0000000000000001
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]


-- Control frame information 
-----------------------------------------------
E, [2021-04-07T15:27:50.430649 #75098] ERROR -- : reaped 
#<Process::Status: pid 98078 SIGSEGV (signal 11) (core dumped)> worker=0
I, [2021-04-07T15:27:50.430976 #75098]  INFO -- : worker=0 spawning...
I, [2021-04-07T15:27:50.439973 #19064]  INFO -- : worker=0 spawned 
pid=19064
I, [2021-04-07T15:27:50.441607 #19064]  INFO -- : Refreshing Gem list
E, [2021-04-07T15:27:51.490681 #75098] ERROR -- : reaped 
#<Process::Status: pid 14713 SIGSEGV (signal 11) (core dumped)> worker=1
I, [2021-04-07T15:27:51.491040 #75098]  INFO -- : worker=1 spawning...
I, [2021-04-07T15:27:51.500370 #66270]  INFO -- : worker=1 spawned 
pid=66270
I, [2021-04-07T15:27:51.501983 #66270]  INFO -- : Refreshing Gem list
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Segmentation fault at 0x0000030bbfc8d6f5
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]



-- Control frame information 
-----------------------------------------------
/var/www/bundler/ruby/3.0/gems/unicorn-6.0.0/lib/unicorn.rb:80: [BUG] 
Segmentation fault at 0x0000000000000001
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-openbsd]


-- Control frame information 
-----------------------------------------------
E, [2021-04-07T15:28:05.676716 #75098] ERROR -- : reaped 
#<Process::Status: pid 19064 SIGSEGV (signal 11) (core dumped)> worker=0
I, [2021-04-07T15:28:05.677110 #75098]  INFO -- : worker=0 spawning...
I, [2021-04-07T15:28:05.685956 #32548]  INFO -- : worker=0 spawned 
pid=32548
I, [2021-04-07T15:28:05.687658 #32548]  INFO -- : Refreshing Gem list
E, [2021-04-07T15:28:06.272044 #75098] ERROR -- : reaped 
#<Process::Status: pid 66270 SIGSEGV (signal 11) (core dumped)> worker=1
I, [2021-04-07T15:28:06.272459 #75098]  INFO -- : worker=1 spawning...
I, [2021-04-07T15:28:06.281695 #65711]  INFO -- : worker=1 spawned 
pid=65711
I, [2021-04-07T15:28:06.283312 #65711]  INFO -- : Refreshing Gem list



--------

A core file is generated:
$ ls -l ruby30.core
-rw-------  1 servidor  servidor  44485672 Apr  7 15:41 ruby30.core


Checking the trace

$ doas pkg_add gdb
$ egdb /usr/local/bin/ruby30 ruby30.core
...
  [New process 601176]
[New process 412220]
[New process 332011]
Core was generated by `ruby30'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000030bbfc70af8 in rb_vm_frame_method_entry ()
    from /usr/local/lib/libruby30.so
[Current thread is 1 (process 601176)]
(gdb) bt
#0  0x0000030bbfc70af8 in rb_vm_frame_method_entry ()
    from /usr/local/lib/libruby30.so
#1  0x0000030bbfca04cb in rb_vmdebug_stack_dump_raw ()
    from /usr/local/lib/libruby30.so
#2  0x0000030bbfca118a in rb_vm_bugreport () from 
/usr/local/lib/libruby30.so
#3  0x0000030bbfabd021 in rb_bug_for_fatal_signal ()
    from /usr/local/lib/libruby30.so
#4  0x0000030bbfbf4470 in sigsegv () from /usr/local/lib/libruby30.so
#5  <signal handler called>
#6  0x0000030bbfc78bb8 in vm_exec_core () from 
/usr/local/lib/libruby30.so
#7  0x0000030bbfc89d95 in rb_vm_exec () from /usr/local/lib/libruby30.so
#8  0x0000030bbfb20b0b in load_iseq_eval () from 
/usr/local/lib/libruby30.so
#9  0x0000030bbfb1ebaf in rb_load_internal () from 
/usr/local/lib/libruby30.so
#10 0x0000030bbfb20216 in rb_f_load () from /usr/local/lib/libruby30.so
#11 0x0000030bbfc9717e in vm_call_cfunc_with_frame ()
    from /usr/local/lib/libruby30.so
#12 0x0000030bbfc8e955 in vm_sendish () from /usr/local/lib/libruby30.so
#13 0x0000030bbfc77292 in vm_exec_core () from 
/usr/local/lib/libruby30.so
#14 0x0000030bbfc89d95 in rb_vm_exec () from /usr/local/lib/libruby30.so
#15 0x0000030bbfb20b0b in load_iseq_eval () from 
/usr/local/lib/libruby30.so
#16 0x0000030bbfb1ebaf in rb_load_internal () from 
/usr/local/lib/libruby30.so
#17 0x0000030bbfb20216 in rb_f_load () from /usr/local/lib/libruby30.so
#18 0x0000030bbfc9717e in vm_call_cfunc_with_frame ()
    from /usr/local/lib/libruby30.so
#19 0x0000030bbfc8e955 in vm_sendish () from /usr/local/lib/libruby30.so
#20 0x0000030bbfc77292 in vm_exec_core () from 
/usr/local/lib/libruby30.so
#21 0x0000030bbfc89d95 in rb_vm_exec () from /usr/local/lib/libruby30.so
#22 0x0000030bbfb20b0b in load_iseq_eval () from 
/usr/local/lib/libruby30.so
#23 0x0000030bbfb1ebaf in rb_load_internal () from 
/usr/local/lib/libruby30.so
#24 0x0000030bbfb20216 in rb_f_load () from /usr/local/lib/libruby30.so
#25 0x0000030bbfc9717e in vm_call_cfunc_with_frame ()
    from /usr/local/lib/libruby30.so
#26 0x0000030bbfc8e955 in vm_sendish () from /usr/local/lib/libruby30.so
#27 0x0000030bbfc77292 in vm_exec_core () from 
/usr/local/lib/libruby30.so
#28 0x0000030bbfc89d95 in rb_vm_exec () from /usr/local/lib/libruby30.so
#29 0x0000030bbfac5044 in rb_ec_exec_node () from 
/usr/local/lib/libruby30.so
#30 0x0000030bbfac4eca in ruby_run_node () from 
/usr/local/lib/libruby30.so
#31 0x0000030997a42cec in main ()


I still have not tried to use the .gdbinit file, but hope to do it soon.


Blessings.

El 2021-04-04 16:03, Eric Wong escribió:
> Jeremy Evans <code@jeremyevans.net> wrote:
>> Unfortunately, given the required amount of setup, I don't think I'll
>> have time to look into this.  The best way to debug this is to start
>> removing code/dependencies piece by piece until the problem goes away.
>> Once the problem goes away, add that code back, and make sure it fails
>> again, then start removing other code/dependencies.  Repeat this 
>> process
>> until you have the most minimal example, where removing any additional
>> code/dependencies will stop the code from failing.
> 
> The above is exactly what I would do, too.
> 
> I would also try to correlate the time of Bus Errors with logs
> of when + which requests are failing, and try replaying only
> those requests to narrow things down.
> 
> Also, do you have core dumps enabled?  Enable those
> ("ulimit -c unlimited" in sh), and run gdb on them as you get
> them.  The .gdbinit in the source tree of the Ruby version
> you're using is helpful not just for Ruby itself, but
> also C extensions, too.  I'm no a gdb expert, but it's
> well-documented and has built-in help.

-- 
Dios, gracias por tu amor infinito.
--
   Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
   http://www.pasosdejesus.org/dominio_publico_colombia.html

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application
  2021-04-07 21:19           ` Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application vtamara
@ 2021-04-08  2:11             ` Jeremy Evans
  2021-04-12 22:47               ` vtamara
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremy Evans @ 2021-04-08  2:11 UTC (permalink / raw)
  To: vtamara; +Cc: Eric Wong, unicorn-public, ports

On 04/07 05:19, vtamara wrote:
> Good evening
> 
> I found that the problem happens also:
> 
> 1. In OpenBSD-current (what will be 6.9 soon) --for that reason I copy to
> ports-openbsd
> 2. With what I consider the minimal rails application,  started with the
> flag --minimal, running with sqlite, i.e:

I committed Ruby 3.0.1 to OpenBSD today.  Does the issue still exist
with Ruby 3.0.1?

Thanks,
Jeremy

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

* Re: Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application
  2021-04-08  2:11             ` Jeremy Evans
@ 2021-04-12 22:47               ` vtamara
  0 siblings, 0 replies; 9+ messages in thread
From: vtamara @ 2021-04-12 22:47 UTC (permalink / raw)
  To: Jeremy Evans; +Cc: Eric Wong, unicorn-public, ports

Hi

No the  issue doesn't exist with Ruby 3.0.1

thank you.

El 2021-04-07 22:11, Jeremy Evans escribió:
> On 04/07 05:19, vtamara wrote:
>> Good evening
>> 
>> I found that the problem happens also:
>> 
>> 1. In OpenBSD-current (what will be 6.9 soon) --for that reason I copy 
>> to
>> ports-openbsd
>> 2. With what I consider the minimal rails application,  started with 
>> the
>> flag --minimal, running with sqlite, i.e:
> 
> I committed Ruby 3.0.1 to OpenBSD today.  Does the issue still exist
> with Ruby 3.0.1?
> 
> Thanks,
> Jeremy

-- 
Dios, gracias por tu amor infinito.
--
   Vladimir Támara Patiño.  http://vtamara.pasosdeJesus.org/
   http://www.pasosdejesus.org/dominio_publico_colombia.html

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

end of thread, other threads:[~2021-04-12 22:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 19:06 Bus Error with Unicorn 6.0 on OpenBSD/adJ 6.8 with Ruby 3.0 vtamara
2021-03-30  1:58 ` Eric Wong
2021-03-30  4:00   ` Jeremy Evans
2021-04-04 11:06     ` vtamara
2021-04-04 16:43       ` Jeremy Evans
2021-04-04 20:03         ` Eric Wong
2021-04-07 21:19           ` Bus Error with Unicorn 6.0 on OpenBSD-current (6.9) with Ruby 3.0 in minimal rails application vtamara
2021-04-08  2:11             ` Jeremy Evans
2021-04-12 22:47               ` vtamara

Code repositories for project(s) associated with this inbox:

	../../../unicorn.git

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).