<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/src/ruby, branch 1.28.0-1</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>Ruby: prevented a segfault on receiving SIGINT (^C).</title>
<updated>2022-08-31T12:17:02+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@f5.com</email>
</author>
<published>2022-08-31T11:49:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc'/>
<id>b26624fc10cc1f4eb88c16ac8fb5b6b4b61895fc</id>
<content type='text'>
As was reported[0] by @travisbell on GitHub, if running unit from the
terminal in the foreground when hitting ^C to exit it, the ruby
application processes would segfault if they were using threads.

It's not 100% clear where the actual problem lies, but it _looks_ like
it may be in ruby.

The simplest way to deal with this for now is to just ignore SIGINT in
the ruby application processes. Unit will still receive and handle it,
cleanly shutting everything down.

For people who want to handle SIGINT in their ruby application running
under unit they can still trap SIGINT and it will override the ignore.

[0]: https://github.com/nginx/unit/issues/562#issuecomment-1223229585

Closes: https://github.com/nginx/unit/issues/562
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As was reported[0] by @travisbell on GitHub, if running unit from the
terminal in the foreground when hitting ^C to exit it, the ruby
application processes would segfault if they were using threads.

It's not 100% clear where the actual problem lies, but it _looks_ like
it may be in ruby.

The simplest way to deal with this for now is to just ignore SIGINT in
the ruby application processes. Unit will still receive and handle it,
cleanly shutting everything down.

For people who want to handle SIGINT in their ruby application running
under unit they can still trap SIGINT and it will override the ignore.

[0]: https://github.com/nginx/unit/issues/562#issuecomment-1223229585

Closes: https://github.com/nginx/unit/issues/562
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: fixed segfault on SIGTERM signal.</title>
<updated>2022-07-28T03:00:15+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-07-28T03:00:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=2bd4a455278dbce756c1dc8be07515f73d611e3b'/>
<id>2bd4a455278dbce756c1dc8be07515f73d611e3b</id>
<content type='text'>
This closes #562 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This closes #562 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: fixed contents of SCRIPT_NAME.</title>
<updated>2022-07-27T10:46:42+00:00</updated>
<author>
<name>Alejandro Colomar</name>
<email>alx.manpages@gmail.com</email>
</author>
<published>2022-06-09T12:39:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=9b4b4925b38333b8d7795331d27db9811f43d72a'/>
<id>9b4b4925b38333b8d7795331d27db9811f43d72a</id>
<content type='text'>
Having the basename of the script pathname was incorrect.  While
we don't have something more accurate, the best thing to do is to
have it empty (which should be the right thing most of the time).

This closes #715 issue on GitHub.

The bug was introduced in git commit
0032543fa65f454c471c968998190b027c1ff270
'Ruby: added the Rack environment parameter "SCRIPT_NAME".'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Having the basename of the script pathname was incorrect.  While
we don't have something more accurate, the best thing to do is to
have it empty (which should be the right thing most of the time).

This closes #715 issue on GitHub.

The bug was introduced in git commit
0032543fa65f454c471c968998190b027c1ff270
'Ruby: added the Rack environment parameter "SCRIPT_NAME".'.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: added stream IO "close" required by Rack specification.</title>
<updated>2022-05-13T11:33:40+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-05-13T11:33:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=5883a2670fbeb1610014ec122a5fd20312399a90'/>
<id>5883a2670fbeb1610014ec122a5fd20312399a90</id>
<content type='text'>
This closes #654 issue on Github.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This closes #654 issue on Github.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: added the Rack environment parameter "SCRIPT_NAME".</title>
<updated>2022-03-09T05:29:43+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2022-03-09T05:29:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=0032543fa65f454c471c968998190b027c1ff270'/>
<id>0032543fa65f454c471c968998190b027c1ff270</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Moving request limit control to libunit.</title>
<updated>2021-10-28T14:46:54+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-10-28T14:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=bba97134e983541e94cf73e93900729e3a3e61fc'/>
<id>bba97134e983541e94cf73e93900729e3a3e61fc</id>
<content type='text'>
Introducting application graceful stop.  For now only used when application
process reach request limit value.

This closes #585 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introducting application graceful stop.  For now only used when application
process reach request limit value.

This closes #585 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: process and thread lifecycle hooks.</title>
<updated>2021-07-02T12:57:55+00:00</updated>
<author>
<name>Oisin Canty</name>
<email>o.canty@f5.com</email>
</author>
<published>2021-07-02T12:57:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=655e321075c0beebe14eba83deeac1ba4c9e0b29'/>
<id>655e321075c0beebe14eba83deeac1ba4c9e0b29</id>
<content type='text'>
This feature allows one to specify blocks of code that are called when certain
lifecycle events occur.  A user configures a "hooks" property on the app
configuration that points to a script.  This script will be evaluated on boot
and should contain blocks of code that will be called on specific events.

An example of configuration:

{
    "type": "ruby",
    "processes": 2,
    "threads": 2,
    "user": "vagrant",
    "group": "vagrant",
    "script": "config.ru",
    "hooks": "hooks.rb",
    "working_directory": "/home/vagrant/unit/rbhooks",
    "environment": {
        "GEM_HOME": "/home/vagrant/.ruby"
    }
}

An example of a valid "hooks.rb" file follows:

File.write("./hooks.#{Process.pid}", "hooks evaluated")

on_worker_boot do
    File.write("./worker_boot.#{Process.pid}", "worker booted")
end

on_thread_boot do
    File.write("./thread_boot.#{Process.pid}.#{Thread.current.object_id}",
               "thread booted")
end

on_thread_shutdown do
    File.write("./thread_shutdown.#{Process.pid}.#{Thread.current.object_id}",
               "thread shutdown")
end

on_worker_shutdown do
    File.write("./worker_shutdown.#{Process.pid}", "worker shutdown")
end

This closes issue #535 on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This feature allows one to specify blocks of code that are called when certain
lifecycle events occur.  A user configures a "hooks" property on the app
configuration that points to a script.  This script will be evaluated on boot
and should contain blocks of code that will be called on specific events.

An example of configuration:

{
    "type": "ruby",
    "processes": 2,
    "threads": 2,
    "user": "vagrant",
    "group": "vagrant",
    "script": "config.ru",
    "hooks": "hooks.rb",
    "working_directory": "/home/vagrant/unit/rbhooks",
    "environment": {
        "GEM_HOME": "/home/vagrant/.ruby"
    }
}

An example of a valid "hooks.rb" file follows:

File.write("./hooks.#{Process.pid}", "hooks evaluated")

on_worker_boot do
    File.write("./worker_boot.#{Process.pid}", "worker booted")
end

on_thread_boot do
    File.write("./thread_boot.#{Process.pid}.#{Thread.current.object_id}",
               "thread booted")
end

on_thread_shutdown do
    File.write("./thread_shutdown.#{Process.pid}.#{Thread.current.object_id}",
               "thread shutdown")
end

on_worker_shutdown do
    File.write("./worker_shutdown.#{Process.pid}", "worker shutdown")
end

This closes issue #535 on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: improved logging of exceptions without backtraces.</title>
<updated>2021-07-01T11:16:43+00:00</updated>
<author>
<name>Oisin Canty</name>
<email>o.canty@f5.com</email>
</author>
<published>2021-07-01T11:16:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=830729a6c5a59615d611575c22516b0fb9dcab3d'/>
<id>830729a6c5a59615d611575c22516b0fb9dcab3d</id>
<content type='text'>
If an exception was raised with a backtrace of zero length, the
nxt_ruby_exception_log() routine would return without logging the
exception class and message.  This commit fixes the issue.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If an exception was raised with a backtrace of zero length, the
nxt_ruby_exception_log() routine would return without logging the
exception class and message.  This commit fixes the issue.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: changing deprecated rb_cData to rb_cObject.</title>
<updated>2021-05-18T10:14:43+00:00</updated>
<author>
<name>Oisin Canty</name>
<email>o.canty@f5.com</email>
</author>
<published>2021-05-18T10:14:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=ead6ed999a87fac6fc9ad3f4f94a6cec1d287b5e'/>
<id>ead6ed999a87fac6fc9ad3f4f94a6cec1d287b5e</id>
<content type='text'>
Ruby 3.0 deprecated rb_cData with the intention to remove it in release 3.1.
This commit changes references of rb_cData to rb_cObject.  This was done so we
can support distributions that package Ruby 3.0, such as Fedora 34.

We also need to call rb_undef_alloc_func because we're no longer deriving from
rb_cData.  This prevents unnecessary allocations.

See:
https://docs.ruby-lang.org/en/3.0.0/doc/extension_rdoc.html

"It is recommended that klass derives from a special class called Data
(rb_cData) but not from Object or other ordinal classes.  If it doesn't,
you have to call rb_undef_alloc_func(klass)."
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ruby 3.0 deprecated rb_cData with the intention to remove it in release 3.1.
This commit changes references of rb_cData to rb_cObject.  This was done so we
can support distributions that package Ruby 3.0, such as Fedora 34.

We also need to call rb_undef_alloc_func because we're no longer deriving from
rb_cData.  This prevents unnecessary allocations.

See:
https://docs.ruby-lang.org/en/3.0.0/doc/extension_rdoc.html

"It is recommended that klass derives from a special class called Data
(rb_cData) but not from Object or other ordinal classes.  If it doesn't,
you have to call rb_undef_alloc_func(klass)."
</pre>
</div>
</content>
</entry>
<entry>
<title>Ruby: fixed encodings initialization.</title>
<updated>2021-03-15T12:03:32+00:00</updated>
<author>
<name>Valentin Bartenev</name>
<email>vbart@nginx.com</email>
</author>
<published>2021-03-15T12:03:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=4c261a7ff8f2b2af08cc2cdee6828af4a1cf7794'/>
<id>4c261a7ff8f2b2af08cc2cdee6828af4a1cf7794</id>
<content type='text'>
The Ruby interpreter expects an explicit setlocale() call before initialization
to pick up character encodings in the "Encoding" class from the environment.

This closes #531 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The Ruby interpreter expects an explicit setlocale() call before initialization
to pick up character encodings in the "Encoding" class from the environment.

This closes #531 issue on GitHub.
</pre>
</div>
</content>
</entry>
</feed>
