-
Type:
Bug
-
Resolution: Done
-
Priority:
Critical - P2
-
Affects Version/s: bson-3.2.4, 2.1.1
-
Component/s: BSON
-
Environment:- Ubuntu 14.04
- MongoDB 3.0.6 using WiredTiger
- Ruby 2.2.3
- Gem bson 3.2.4
- Gem mongo 2.1.1
- Gem mongoid 5.0.0
- Gem origin 2.1.1
-
None
-
Fully Compatible
-
None
-
None
-
None
-
None
-
None
-
None
When accessing mongodb through SSL, Regexp attributes can't be read from the database. https://github.com/mongodb/bson-ruby/blob/master/lib/bson/regexp.rb#L156 hangs indefinitely as the options are NULL_BYTE terminated.
Note that this issue only occurs when connecting through SSL. On an unencrypted connection, options are indeed "0" terminated and the bug thus doesn't manifest itself using non-encrypted connections.
The parsing of the options itself is also subject to differences between SSL and non-SSL connections. I will submit an pull request shortly but also wanted to create an issue here for reference and discussion.
Test case in Rails:
class TestRecord include Mongoid::Document field :regex, type: Regexp end TestRecord.create(regex: //).reload # Will never return when connecting to MongoDB through SSL