[CDRIVER-1523] Configuring libbson with --enable-extra-align=no when building with mongoc Created: 06/Sep/16 Updated: 03/Jan/18 Resolved: 18/Oct/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | Build, libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.5.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Hannes Magnusson | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
libbson's "EXTRA_ALIGN" (--enable-extra-align=yes) is deprecated and should only be used when maintaining libbson ABI compatibility. When we configure libbson and install as part of mongoc (since there was no system installed libbson), then there is no ABI compatibility worry, and we should configure the library properly |
| Comments |
| Comment by Arseny Vakhrushev [ 03/Jan/18 ] | |||||||||||||||||||||||||||||||||||||||
|
Hi Jesse! Yes, I am aware of the problem extra alignment causes with the current 1.x version, and that you're trying to maintain ABI. I guess you're right about make install in this case. Hope version 2.0 isn't far away. As to bson_init(), sorry for the confusion! I mean the bug goes away if bson_init() is used instead of bson_init_from_json() to illustrate that it's the nested call to bson_append_document_begin() that crashes the system, not pure initialization. | |||||||||||||||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 03/Jan/18 ] | |||||||||||||||||||||||||||||||||||||||
|
Hi Arseny. You're right, installing libbson from the bundled source code still enables extra alignment. I think that this is the correct behavior, actually: "make install" will install both libmongoc and libbson in the system library directory, so both libmongoc and libbson must maintain ABI with previous versions. I'm curious about your code example. Why does calling "bson_init" before "bson_init_from_json" prevent a crash? After all, bson_init_from_json also calls bson_init, so I don't understand why calling bson_init before bson_init_from_json would have any effect. | |||||||||||||||||||||||||||||||||||||||
| Comment by Arseny Vakhrushev [ 02/Jan/18 ] | |||||||||||||||||||||||||||||||||||||||
|
I am observing the same bug in libbson when compiled and installed as part of mongoc 1.9.0.
Please note that extra alignment is still ON in bundled mode. As a result, libbson crashes big time on FreeBSD and macOS (no problem on Linux though):
P.S. The bug goes away with --enable-debug. | |||||||||||||||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 18/Oct/16 ] | |||||||||||||||||||||||||||||||||||||||
|
Fixed in https://github.com/mongodb/mongo-c-driver/commit/776a49fad683501d2934cd8b16d887d0d7bba43a | |||||||||||||||||||||||||||||||||||||||
| Comment by Bernie Hackett [ 18/Oct/16 ] | |||||||||||||||||||||||||||||||||||||||
|
Is this a bug or a task? |