ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: michal.samluk@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:94447] [Ruby master Bug#14716] SecureRandom throwing an error in Ruby 2.5.1
Date: Tue, 20 Aug 2019 15:21:33 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-80873.20190820152132.58edff286956d61f@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14716.20180427061906@ruby-lang.org

Issue #14716 has been updated by michalsamluk (Michał Samluk).

ruby -v changed from 2.5.3 to 2.6.3

Hi,
I am having same issue while running seed data (ruby 2.6.3). I am having it while uplaoding attachments. 

```
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/core_ext/securerandom.rb:39:in `base36'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activestorage-6.0.0.rc2/app/models/active_storage/blob.rb:89:in `generate_unique_secure_token'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/secure_token.rb:32:in `block in has_secure_token'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:429:in `instance_exec'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:606:in `catch'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:202:in `block in halting'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `each'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `invoke_before'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:827:in `_run_create_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/callbacks.rb:332:in `_create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/timestamp.rb:111:in `_create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/persistence.rb:906:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/callbacks.rb:328:in `block in create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:135:in `run_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/callbacks.rb:328:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/timestamp.rb:129:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/persistence.rb:470:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/validations.rb:46:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:315:in `block in save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:275:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:212:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:315:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/suppressor.rb:44:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/autosave_association.rb:489:in `save_belongs_to_association'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/autosave_association.rb:204:in `block in add_autosave_association_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/autosave_association.rb:159:in `instance_eval'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/autosave_association.rb:159:in `block in define_non_cyclic_method'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:606:in `catch'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:202:in `block in halting'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `each'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:514:in `invoke_before'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:134:in `run_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/callbacks.rb:328:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/timestamp.rb:129:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/persistence.rb:470:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/validations.rb:46:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:315:in `block in save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:275:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:212:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:315:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/suppressor.rb:44:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_one_association.rb:58:in `block in replace'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_one_association.rb:103:in `block in transaction_if'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:275:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:212:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_one_association.rb:103:in `transaction_if'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_one_association.rb:51:in `replace'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/singular_association.rb:17:in `writer'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/builder/association.rb:108:in `media_attachment='
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activestorage-6.0.0.rc2/lib/active_storage/attached/changes/create_one.rb:32:in `public_send'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activestorage-6.0.0.rc2/lib/active_storage/attached/changes/create_one.rb:32:in `save'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activestorage-6.0.0.rc2/lib/active_storage/attached/model.rb:54:in `block in has_one_attached'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:429:in `instance_exec'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:239:in `block in halting_and_conditional'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:518:in `block in invoke_after'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:518:in `each'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:518:in `invoke_after'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:136:in `run_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc2/lib/active_support/callbacks.rb:827:in `_run_save_callbacks'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/callbacks.rb:328:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/timestamp.rb:129:in `create_or_update'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/persistence.rb:503:in `save!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/validations.rb:52:in `save!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:319:in `block in save!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:275:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:212:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:319:in `save!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/suppressor.rb:48:in `save!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:360:in `insert_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_many_association.rb:36:in `insert_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:347:in `block (2 levels) in _create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:443:in `replace_on_target'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:285:in `add_to_target'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:346:in `block in _create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:135:in `block in transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `block in transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/transactions.rb:212:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:134:in `transaction'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_association.rb:344:in `_create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/has_many_association.rb:116:in `_create_record'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/association.rb:195:in `create!'
/Users/myuser/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0.rc2/lib/active_record/associations/collection_proxy.rb:363:in `create!'
```

----------------------------------------
Bug #14716: SecureRandom throwing an error in Ruby 2.5.1
https://bugs.ruby-lang.org/issues/14716#change-80873

* Author: snehavas (sneha vasanth)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.3
* Backport: 2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED
----------------------------------------
Hi,

We recently upgraded from ruby 2.3.6 to 2.5.1.
We use SecureRandom.uuid to generate a random number for our session.
Post the upgrade we have been getting the following error intermittently

```
app error: failed to get urandom (RuntimeError)
E, [2018-04-27T04:55:08.741859 #16550] ERROR -- : /usr/lib/ruby/2.5.0/securerandom.rb:99:in `urandom'
E, [2018-04-27T04:55:08.741898 #16550] ERROR -- : /usr/lib/ruby/2.5.0/securerandom.rb:99:in `gen_random_urandom'
E, [2018-04-27T04:55:08.741932 #16550] ERROR -- : /usr/lib/ruby/2.5.0/securerandom.rb:129:in `random_bytes'
E, [2018-04-27T04:55:08.741965 #16550] ERROR -- : /usr/lib/ruby/2.5.0/securerandom.rb:219:in `uuid'
E, [2018-04-27T04:55:08.741997 #16550] ERROR -- : /usr/share/nginx/frontend/app/utilities/log.rb:74:in `create_session_info'
E, [2018-04-27T04:55:08.742036 #16550] ERROR -- : /usr/share/nginx/frontend/app/utilities/log.rb:11:in `context'
```

We understand that there was a change in ruby 2.5.1 where we now look at OS sources as the first point of contact to generate random numbers as opposed to OpenSSL.
Any idea why this could be happening?







-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2019-08-20 15:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14716.20180427061906@ruby-lang.org>
2018-04-27  6:19 ` [ruby-core:86709] [Ruby trunk Bug#14716] SecureRandom throwing an error in Ruby 2.5.1 snehavas
2018-04-27  6:29 ` [ruby-core:86711] [Ruby trunk Bug#14716][Feedback] " nobu
2018-04-27  7:34 ` [ruby-core:86714] [Ruby trunk Bug#14716] " snehavas
2018-04-27  7:36 ` [ruby-core:86715] " snehavas
2018-04-27  8:45 ` [ruby-core:86720] [Ruby trunk Bug#14716][Open] " naruse
2018-04-27  8:54 ` [ruby-core:86721] [Ruby trunk Bug#14716] " naruse
2018-04-27  9:23 ` [ruby-core:86722] " shyouhei
2018-04-27  9:44 ` [ruby-core:86723] " snehavas
2018-08-01 22:54 ` [ruby-core:88264] " pbrinichlanglois
2018-09-06 17:44 ` [ruby-core:88885] " pbrinichlanglois
2019-03-03 10:33 ` [ruby-core:91655] " ruby-lang
2019-08-20 15:21 ` michal.samluk [this message]
2019-08-22 11:59 ` [ruby-core:94479] [Ruby master " konstantin.filtschew
2019-08-30 13:41 ` [ruby-core:94684] " emil
2019-09-22 16:38 ` [ruby-core:95034] " miles.lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-80873.20190820152132.58edff286956d61f@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).