Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickpeterse/59c9e6e5758bdff1bf4e to your computer and use it in GitHub Desktop.
Save yorickpeterse/59c9e6e5758bdff1bf4e to your computer and use it in GitHub Desktop.
Starting threads...
An exception occurred running /tmp/openssl_thread.rb:
Expected digest "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" to equal "83103cff21a7a50e45eb90c29ca9d24204d95fe7369565ec1d5339750da386ab" (RuntimeError)
Backtrace:
{ } in Object#__script__ at /tmp/openssl_thread.rb:23
Kernel(Object)#loop at kernel/common/kernel.rb:511
{ } in Object#__script__ at /tmp/openssl_thread.rb:16
Proc#call at kernel/bootstrap/proc.rb:20
Thread#__run__ at kernel/bootstrap/thread.rb:356
Invalid handle usage detected!
handle: 0x7f3a1c015c30
checksum: 0x0
references: 2
type: 0
object: 0
Abort!
rbx(_ZN8rubinius5abortEv+0x7c) [0x5e532c]
rbx(rb_typeddata_is_kind_of+0) [0x87a050]
/home/yorickpeterse/.rubies/rbx-git/gems/gems/rubysl-openssl-2.3.0/lib/openssl/openssl.so(+0x390b8) [0x7f3a3edf20b8]
rbx() [0x844c6f]
rbx(_ZN8rubinius12NativeMethod23executor_implementationINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x537) [0x843d47]
rbx(_ZN8rubinius4capi27capi_funcall_backend_nativeEPNS_23NativeMethodEnvironmentEPKciPNS_6ObjectEPNS_6SymbolEmPS6_S6_b+0x115) [0x8750e5]
rbx(rb_funcall+0x249) [0x876e79]
/home/yorickpeterse/.rubies/rbx-git/gems/gems/rubysl-digest-2.0.3/lib/digest/digest.so(+0x1dea) [0x7f3a3f007dea]
rbx() [0x844c6f]
rbx(_ZN8rubinius12NativeMethod23executor_implementationINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x537) [0x843d47]
rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x249a) [0x5ec6ea]
rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x45e) [0x81091e]
rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x1e9) [0x8103c9]
rbx(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d) [0x810c2d]
rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x332f) [0x5ed57f]
rbx(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x458) [0x649818]
rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x25a0) [0x5ec7f0]
rbx(_ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x45e) [0x81091e]
rbx(_ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE+0x1e9) [0x8103c9]
rbx(_ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi+0x3d) [0x810c2d]
rbx(_ZN8rubinius4Proc4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsE+0x25c) [0x858e8c]
rbx(_ZN8rubinius10Primitives9proc_callEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x66) [0x712796]
rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2744) [0x5ec994]
rbx(_ZN8rubinius11MachineCode19execute_specializedINS_17SplatOnlyArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x471) [0x64a5c1]
rbx(_ZN8rubinius11MachineCode11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE+0x2744) [0x5ec994]
rbx(_ZN8rubinius11MachineCode19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0x458) [0x649818]
rbx(_ZN8rubinius6Object4sendEPNS_5StateEPNS_9CallFrameEPNS_6SymbolEb+0xa6) [0x84d9b6]
rbx(_ZN8rubinius6Thread3runEPv+0x26a) [0x868caa]
/usr/lib/libpthread.so.0(+0x7374) [0x7f3a40369374]
require 'openssl'
require 'thread'
puts "rubysl-openssl: #{RubySL::OpenSSL::VERSION}"
puts "rubysl-digest: #{RubySL::Digest::VERSION}"
Thread.abort_on_exception = true
input = 'the cake is possibly a lie'
digest = OpenSSL::Digest::SHA256.new
digest.update(input)
expected = digest.hexdigest
puts 'Starting threads...'
threads = 10.times.map do
Thread.new do
loop do
digest = OpenSSL::Digest::SHA256.new
digest.update(input)
got = digest.hexdigest
if got != expected
raise "Expected digest #{got.inspect} to equal #{expected.inspect}"
end
end
end
end
threads.each(&:join)
Starting threads...
An exception occurred running /tmp/openssl_thread.rb:
Expected digest "70b9d40465992fa71a861e050481fb1a4bed5c8aa127272e7bf5838a3b0ab240" to equal "83103cff21a7a50e45eb90c29ca9d24204d95fe7369565ec1d5339750da386ab" (RuntimeError)
Backtrace:
{ } in Object#__script__ at /tmp/openssl_thread.rb:23
Kernel(Object)#loop at kernel/common/kernel.rb:511
{ } in Object#__script__ at /tmp/openssl_thread.rb:16
Proc#call at kernel/bootstrap/proc.rb:20
Thread#__run__ at kernel/bootstrap/thread.rb:356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment