-
Notifications
You must be signed in to change notification settings - Fork 80
nil.unpack issue #28
Comments
I got a similar issue while using UUID::generate on jruby-1.7.0-preview2 |
I was unable to replicate this using jruby-1.7.2 (1.9.3p327), uuid-2.3.6, rails-3.2.11.
Within irb:
No issues. I even tried requiring most of the gems available from |
I'm seeing the same issue with ruby ruby 1.9.3p385 when calling UUID.new.generate with gem version 2.3.6. stacktrace:
(replaced parts of the path by ...) |
We are seeing this issue as well. We are using ruby 2.0.0-p0, rails 3.2.13. We encounter the error about once a day. error: undefined method `unpack' for nil:NilClass
Note that we have about 50 separate processes hitting this code at once. |
Same thing here.
I'm using Ruby 2.0.0 All other software versions can be seen above. |
Any progress on this issue? |
+1 |
You can set state_file to false, but this might leave you with duplicated ids generated on the same machine, right? Any drawbacks to simply retrying? class UUID
# Workaround for UUID gem failing sometimes on lock file access in a multiprocess environment
# Which throws NoMethodError: undefined method `unpack' for nil:NilClass
def generate_with_retry(*args)
retries = 0
begin
generate_without_retry(*args)
rescue StandardError => error
retries += 1
retry if retries < 3
raise error, "[After trying #{retries} times] #{error.message}", error.backtrace
end
end
alias_method_chain :generate, :retry # rails only, roll your own alias_method calls if outside rails
end |
I'm seeing this as well, @gtmax have you tried your code in a production environment ? |
@slemiere Yes, we are running with this code. However, from what I recall for some reason this still didn't solve the high-frequency concurrent multi-process UUID generation - and we realized that actually we didn't need a completely unique id there and switched to a cheaper SecureRandom. |
I can easily reproduce this problem on linux machine with: require 'uuid'
20.times do
fork { UUID.new while true }
end
Process.waitall |
@kazjote I can confirm that's the case on OS X 10.10 as well. |
Just hit this on production as well. |
We switched to SecureRandom as well. |
I also have it with ruby-2.3.0 on Ubuntu 12.04/14.04. I rarely occurs but I am having it like 10 times a day.
|
UUID gem randomly fails when generating UUIDs with high frequency. See: assaf/uuid#28
We are seeing this issue when using uuid:2.3.9 with ruby 2.3.6 in our production environment. Has happened twice in the last 30 days. Is the solution to use |
@vineethvakeel we moved to |
I got this error
The error occurred while evaluating nil.unpack
I am using uuid-2.0.2 with rails2.3.4
The text was updated successfully, but these errors were encountered: