Граф коммитов

168 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA 3cfb7afbfe [ruby/drb] Bump version to 2.1.1
https://github.com/ruby/drb/commit/7c2d56e9f3
2022-12-05 05:59:33 +00:00
Yusuke Endoh b4e362d444 lib/drb/drb.rb: Prevent a "warning: assigned but unused variable"
... by replacing the variable with a underscore-prefixed name
2022-01-17 14:56:11 +09:00
Masatoshi SEKI 64e19ad7e9 to prevent collection, keep the last result. 2022-01-15 00:58:21 +09:00
Koichi Sasada 53a4e10146 clear `@result` after `setup_message`
For the remote object `ro`, method chain like `ro.foo.bar` the
result of `ro.foo` is stored in `@result`, but cleared just
before `setup_message` and it seems GCed on specific machine.

```
  1) Error:
DRbTests::TestDRbCore#test_05_eq:
RangeError: "140" is recycled object
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:366:in `_id2ref'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:366:in `to_obj'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1528:in `to_obj'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1847:in `to_obj'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:620:in `recv_request'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:931:in `recv_request'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1656:in `init_with_client'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1668:in `setup_message'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1632:in `perform'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1725:in `block (2 levels) in main_loop'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1721:in `loop'
    (druby://localhost:36141) /tmp/ruby/v3/src/trunk-repeat20-asserts/lib/drb/drb.rb:1721:in `block in main_loop'
    /tmp/ruby/v3/src/trunk-repeat20-asserts/test/drb/drbtest.rb:206:in `test_05_eq'
```

To prevent collecting, clear `@result` just after `setup_message`
and `setup_message` can get the last result object.
2022-01-14 18:33:16 +09:00
Nobuyoshi Nakada 56a0f34d31 [ruby/drb] Fix method names "regist" as "register"
https://github.com/ruby/drb/commit/9a1ff286bc
2021-12-27 18:11:48 +09:00
Hiroshi SHIBATA befb37c2c4
[ruby/drb] Bump up drb version to 2.1.0
https://github.com/ruby/drb/commit/e4b7b68d67
2021-10-14 21:14:35 +09:00
Hiroshi SHIBATA 20bd9e7c61
[ruby/drb] Bump up drb version to 2.0.5
https://github.com/ruby/drb/commit/7edf67654c
2021-10-14 21:14:35 +09:00
Hiroshi SHIBATA af68070068 [ruby/drb] 6d890ec5979ec72586dd5f66dd8d33f7a9aefd1e was introduced to support only Ruby 2.7+
https://github.com/ruby/drb/commit/bec410d184
2021-09-28 17:31:23 +09:00
Olle Jonsson 3be987653a [ruby/drb] gemspec: Remove "executables" configuration
This gem exposes 0 executables.

https://github.com/ruby/drb/commit/ed4d0363e5
2021-09-28 17:30:58 +09:00
Hiroshi SHIBATA bb5747e18a
Added ruby2_keywords for Ruby 2.5 and 2.6 2021-01-18 20:41:33 +09:00
Hiroshi SHIBATA a0d1152d2e [ruby/drb] Removed needless files from Gem::Specification#files
https://github.com/ruby/drb/commit/61c49af71b
2020-12-28 18:41:02 +09:00
Nobuyoshi Nakada 3198e7abd7
Separate `send` into `public_send` and `__send__` 2020-10-27 16:12:45 +09:00
Hiroshi SHIBATA 1e316edf60
Promote drb to the default gems 2020-10-14 14:42:53 +09:00
Hiroshi SHIBATA d55c914f0f Removed DRb.default_safe_level and DRb#safe_level 2020-09-11 10:52:52 +09:00
Bart de Water 3621a7debf Avoid deprecated OpenSSL::Digest constants 2020-06-29 13:25:32 +09:00
Yusuke Endoh fb472ca7ad lib/drb/drb.rb: Use ruby2_keywords for keyword separation
[Bug #16634]
2020-02-15 16:27:03 +09:00
Kazuhiro NISHIYAMA 7be550d046
Stop Thread.new in `DRb::TimerIdConv::TimerHolder2#on_gc`
and add more stop_pool after stop_service
2019-12-10 12:43:49 +09:00
Kazuhiro NISHIYAMA 173b864668
Do not start thread when `require 'drb/drb'` only 2019-12-06 00:12:58 +09:00
Yusuke Endoh d43b9eb22d lib/drb/drb.rb: suppress warning: instance variable @pool_proxy not initialized 2019-12-05 22:37:08 +09:00
Kazuhiro NISHIYAMA a0bc0e1ba1 Fix thread leak in drb 2019-12-04 20:57:24 +09:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
Jeremy Evans d5744aff3a Fix DRbServer#any_to_s
My previous fix in d0ed935d5b was
not correct, as pointed out by cremno on GitHub.

This simplifies things by just using Kernel#to_s.  Also switch to
bind_call(obj) instead of bind(obj).call for better performance.
2019-10-16 12:51:13 -07:00
Jeremy Evans 567e312d1f Do not raise an exception on a closed DRb socket
This rescues some exceptions that could happen with a closed or
shutdown DRb socket. This can prevent the server from
exiting if an client socket is closed directly after it is
accepted.

Fixes [Bug #8039]
2019-10-16 12:51:13 -07:00
Jeremy Evans 50b8033d6b Handle subclasses of Exception in drb
This makes it so that client instances that call a method on a
server-side object that raise a subclass of Exception are handled
similarly to those that raise a subclass of StandardError.

Only reraise exceptions that we are fairly sure we don't want to
rescue.

Fixes [Bug #5618]
2019-10-16 12:51:13 -07:00
Masatoshi SEKI c3a6260302 add require "monitor" 2019-10-14 22:56:37 +09:00
Masatoshi SEKI 8488d5b5b6 Automatically close fds on fork (and GC). The connection pools are maintained at thread scope. 2019-10-14 20:30:22 +09:00
Jeremy Evans d0ed935d5b Fix some DRb issues (#2552)
* Handle BasicObject in drb

Also fix a bug in rescue clause of any_to_s because sprintf
does not handle the %l modifier.

Fixes [Bug #7833]

* Do not send a reply to the client if there is a connection error

This allows for normal TCP shutdown (fin-ack-fin-ack instead of
fin-ack-push-rst).

Patch from pierre@mouraf.org (Pierre-Alexandre Meyer).

Fixes [Bug #2339]

* Detect fork and do not reuse forked connections in drb

This associates each DRbConn with a pid, and if the pid changes,
it closes any DRbConns in the pool with a pid that no longer
matches.  This fixes DRb servers from sending messages intended
for one client to another client after forking.

Fixes [Bug #2718]
Fixes [Bug #14471]
2019-10-14 14:20:32 +09:00
Masatoshi SEKI cbe623f1c7 change default value of load_limit (ignore load_limit) 2019-07-13 07:22:55 +09:00
git 7d30cd47c4 * remove trailing spaces. 2019-05-04 19:29:14 +09:00
Masatoshi SEKI 8980b53a48 add DRb::WeakIdConv (Bug #15711) 2019-05-04 19:28:57 +09:00
normal fb0009cfdc drb: fix tests on Debian sid/unstable with OpenSSL 1.1.1a
OpenSSL complains abour our keys being small and weak :<
Make them big and strong with 2048-bit RSA keys and SHA256 digests

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 04:51:13 +00:00
kazu 972cf8c91e Fix up r65505 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-05 07:01:49 +00:00
marcandre e859e668d2 lib/*: Prefer require_relative over require.
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:33 +00:00
kazu eab51f71d6 Revert "Revert "Reset primary_server when remove_server"" [ci skip]
This reverts commit d2671c96f32e6fbbd39162a2c9042dcaf3bf2d68.

previous reverting is commit miss

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 13:14:00 +00:00
kazu 12b085a7bf Allow to stop by push(nil) for test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 12:28:52 +00:00
kazu 129316dd1f Revert "Reset primary_server when remove_server"
This reverts commit 2948d3bd2e78b5b9110454a7135a81c3fecb2575.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 12:28:45 +00:00
kazu a4c4560f32 Reset primary_server when remove_server
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 07:49:34 +00:00
normal 7c31c2738c drb: close graceful shutdown pipe before socket
Closing a listen socket while entering select(2) may
trigger IOError or even deadlock because another thread
may give the file descriptor to another file description;
meaning the kernel can wait on the wrong description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 02:32:15 +00:00
normal a48022489f drb: simplify shutdown pipe close logic
IO#close is idempotent, so we don't need to waste bytecode
to check or nil it at shutdown time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-25 02:32:10 +00:00
a_matsuda c6d5b61745 Fix typo of file path [ci skip]
Patch by: yuuji.yaginuma <yuuji.yaginuma@gmail.com>

https://github.com/ruby/ruby/pull/1900
[Fix GH-1900]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-28 03:48:52 +00:00
normal 0c53b40033 lib/drb/extservm.rb (service): do not return `false'
invoke_service_command may set entries in @servers to `false',
making it incompatible with the intended use of the
safe navigation operator.

This caused occasional DRb test failures, but they were hidden
with automatic retry.

[ruby-core:87524] [Bug #14856]

Fixes: r53111 ("use safe navigation operator")
	commit 059c9c1cf3 [GH-1142]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-19 23:20:36 +00:00
seki 3381ffee1d If host of URI is omitted, make it with IP address.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-17 15:13:39 +00:00
nobu d83e02017e drb: use \A and \z
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-30 12:10:43 +00:00
ko1 c39bdb798d `$SAFE` as a process global state. [Feature #14250]
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to
  `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state.

* vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc`
  objects don't need to keep `$SAFE` at the creation.
  Also make `is_from_method` and `is_lambda` as 1 bit fields.

* cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation.

* eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access
  `vm->safe_level_` directly.

* eval_jump.c: End procs `END{}` doesn't keep `$SAFE`.

* proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c.

* safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes.

* safe.c (safe_setter): use `rb_set_safe_level()`.

* thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`.
  It should be obsolete.

* transcode.c (load_transcoder_entry): `rb_safe_level()` only returns
  0 or 1 so that this check is not needed.

* vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc.

* vm.c (rb_proc_create): renamed to `proc_create`.

* vm.c (rb_proc_dup): moved from proc.c.

* vm.c (vm_invoke_proc): do not need to set and restore `$SAFE`
  for `Proc#call`.

* vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer
  meaning.

* lib/drb/drb.rb: restore `$SAFE`.

* lib/erb.rb: restore `$SAFE`, too.

* test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests.

* test/rubygems/test_gem.rb: do not set `$SAFE = 1`.

* bootstraptest/test_proc.rb: catch up this change.

* spec/ruby/optional/capi/string_spec.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

* test/fiddle/test_func.rb: ditto.

* test/fiddle/test_handle.rb: ditto.

* test/net/imap/test_imap_response_parser.rb: ditto.

* test/pathname/test_pathname.rb: ditto.

* test/readline/test_readline.rb: ditto.

* test/ruby/test_file.rb: ditto.

* test/ruby/test_optimization.rb: ditto.

* test/ruby/test_proc.rb: ditto.

* test/ruby/test_require.rb: ditto.

* test/ruby/test_thread.rb: ditto.

* test/rubygems/test_gem_specification.rb: ditto.

* test/test_tempfile.rb: ditto.

* test/test_tmpdir.rb: ditto.

* test/win32ole/test_win32ole.rb: ditto.

* test/win32ole/test_win32ole_event.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 20:09:24 +00:00
eregon 06c7693c1f Break out of the loop after shutdown in DRbServer
* Patch by @seki:
  https://gist.github.com/seki/ae8bef20238c37c94a91b5461c4bfbdd

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-19 15:40:13 +00:00
eregon ca1c3d41fa Avoid creating a Thread for shutting down a DRbServer
* lib/drb/drb.rb: avoid creating a Thread and call the shutdown logic
  directly. Do not try to kill or join the current Thread.
  Thread.new { stop_service } caused "can't alloc thread (ThreadError)",
  which is shown with Thread.report_on_exception = true.
  [Bug #14171]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 18:43:55 +00:00
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.

This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.

This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.

This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.

rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.

From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:56:25 +00:00
knu 49ce3ca374 Make ACL::ACLEntry not suppress IPAddr::InvalidPrefixError
This is because it would be a user error because a pattern containing
a slash shouldn't be a host name pattern but an IP address pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:53:52 +00:00
kazu 6064132c42 Remove unnecessary `require 'thread'`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00