Skip to content

Commit f69fc39

Browse files
Merge pull request #175 from datastax/RUBY-219
RUBY-219 - SortedSet first-time initialization is unstable in a multi…
2 parents a520f40 + 5e9aa43 commit f69fc39

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Features:
33

44
Bug Fixes:
5+
* [RUBY-219](https://datastax-oss.atlassian.net/browse/RUBY-219) Sometimes get stack trace in metadata.rb due to failure in SortedSet initialization.
56

67

78
# 3.0.0 GA

lib/cassandra.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,11 @@ def self.validate_and_massage_options(options)
834834
# murmur3 hash extension
835835
require 'cassandra_murmur3'
836836

837+
# SortedSet has a race condition where it does some class/global initialization when the first instance is created.
838+
# If this is done in a multi-threaded environment, bad things can happen. So force the initialization here,
839+
# when loading the C* module.
840+
::SortedSet.new
841+
837842
module Cassandra
838843
# @private
839844
VOID_STATEMENT = Statements::Void.new

0 commit comments

Comments
 (0)