timer-thread may set trap interrupt with rb_threadptr_check_signal
at any time independent of GVL. This means timer-thread may set
the trap interrupt flag on the previous execution context; causing
the flag to be unnoticed until a future ec switch (or lost
completely if the ec is done).
Note: I avoid relying on th->interrupt_lock here and use
atomics because we won't be able to rely on it for proposed lazy
timer-thread [Misc #14937].
This regression affects Ruby 2.5 as it was introduced by moving
interrupt_flag to `ec' which is an unstable pointer. Ruby <= 2.4
was unaffected because vm->main_thread->interrupt_flag never
changed.
[ruby-core:88119] [Bug #14939]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This adds a password_hash keyword argument to
WEBrick::HTTPAuth::Htpasswd#initialize. If set to :bcrypt, it
will create bcrypt hashes instead of crypt hashes, and will
raise an exception if the .htpasswd file uses crypt hashes.
If :bcrypt is used, then instead of calling
BasicAuth.make_passwd (which uses crypt),
WEBrick::HTTPAuth::Htpasswd#set_passwd will set the bcrypt
password directly. It isn't possible to change the
make_passwd API to accept the password hash format, as that
would break configurations who use Htpasswd#auth_type= to set
a custom auth_type.
This modifies WEBrick::HTTPAuth::BasicAuth to handle checking
both crypt and bcrypt hashes.
There are commented out requires for 'string/crypt', to handle
when String#crypt is deprecated and the undeprecated version is
moved to a gem.
There is also a commented out warning for the case when
the password_hash keyword is not specified and 'string/crypt'
cannot be required. I think the warning makes sense to nudge
users to using bcrypt.
I've updated the tests to test nil, :crypt, and :bcrypt values
for the password_hash keyword, skipping the bcrypt tests if the
bcrypt library cannot be required.
[ruby-core:88111] [Feature #14940]
From: Jeremy Evans <code@jeremyevans.net>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`trunk@42862` dropped example's last line.
e334bb2ce5 (diff-8783a9b452e430bcf0d7b0c6e34f1db0L144)e334bb2ce5 (diff-38e7b9d781319cfbc49445f8f6625b8aR195)
This brings no output.
```queue_example1.rb
queue = Queue.new
producer = Thread.new do
5.times do |i|
sleep rand(i) # simulate expense
queue << i
puts "#{i} produced"
end
end
consumer = Thread.new do
5.times do |i|
value = queue.pop
sleep rand(i/2) # simulate expense
puts "consumed #{value}"
end
end
```
```queue_example2.rb
queue = Queue.new
producer = Thread.new do
5.times do |i|
sleep rand(i) # simulate expense
queue << i
puts "#{i} produced"
end
end
consumer = Thread.new do
5.times do |i|
value = queue.pop
sleep rand(i/2) # simulate expense
puts "consumed #{value}"
end
end
consumer.join
```
$ ruby queue_example1.rb
$
$ ruby queue_example2.rb
0 produced
1 produced
consumed 0
consumed 1
2 produced
consumed 2
3 produced
consumed 3
4 produced
consumed 4
$
Co-Authored-By: Sanemat <o.gata.ken@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Since 2.5, Module#define_method is public. (feature #14133)
Co-Authored-By: Miguel Landaeta <miguel@miguel.cc>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because it's more suitable to describe the current behavior now.
tool/ruby_vm/models/bare_instructions.rb: ditto.
tool/ruby_vm/views/_insn_entry.erb: ditto.
tool/ruby_vm/views/_mjit_compile_insn_body.erb: ditto.
tool/ruby_vm/views/_mjit_compile_pc_and_sp.erb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
by whether on mswin or not.
This is needed because I'm going to renew the compilation process for
unix, keeping mswin builds as it is, at first.
This commit is not changing the behavior at all.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts commit r63982.
It breaks build on Solaris 11.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
which was missing in r64033.
Prior to r64033, memory allocation failure had been checked by
TRY_WITH_GC and handled by rb_memerror. But calling rb_memerror on MJIT
worker is problematic since it does EC_JUMP_TAG in the end. Threads
except Ruby's main thread must not use it.
mjit_compile.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because such inconsistency may result in the regression fixed in r64034.
vm_exec is not touched since renaming it may be controversial...
vm_args.c: ditto.
vm_eval.c: ditto.
vm_insnhelper.c: ditto.
vm_method.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on r64031. Compiling vm_search_method_slowpath is very slow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mjit_compile.c: ditto.
REALLOC_N, ALLOC_N and xmalloc trigger GC but it's not expected.
Other allocation calls in mjit.c are executed on Ruby's main thread and
thus fine.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
in a short term, and add retries to prevent random CI failures by it.
I remember this and will address it later for sure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
http://ci.rvm.jp/results/trunk-asserts-nopara@silicon-docker/1149270
```
/home/ko1/ruby/src/trunk-asserts-nopara/process.c: In function 'assert_close_on_exec':
/home/ko1/ruby/src/trunk-asserts-nopara/process.c:298:9: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
(void)write(2, m, sizeof(m) - 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
workaround from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
of non-void functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_io.rb (test_select_leak): increase timeout seconds
to pass this test on a high-load machine.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
There's no need to resize each rb_fdset_t to match the size of
the biggest one. This can allow some small memory savings if
watching several sets of FDs simultaneously.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c (rb_f_integer): prefer `base` optional argument over
keyword arguments. this issue should be resolved more generally
by separating keyword arguments from hashes in the future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e