[SERVER-7080] On Solaris, link to backtrace() at run-time or emulate it if not found Created: 20/Sep/12 Updated: 11/Jul/16 Resolved: 01/Jul/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Logging |
| Affects Version/s: | 2.2.0 |
| Fix Version/s: | 2.4.6, 2.5.1 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Eric Milkie | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Oracle Solaris |
||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | Solaris | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Solaris 11 has a working backtrace() function (which we use for stack traces), but Solaris 10 does not. When present, this function, and related functions backtrace_symbols and backtrace_symbols_fd, are found in libc.so.1, which is generally in /lib/64 (aka /lib/amd64). We should not have an external reference to backtrace but should instead search for it in libc.so.1 and use it if found. If not found, we should emulate it using printstack() and walkcontext(). This will make the same binary runnable on both Solaris 10 and Solaris 11 and will use the native function on Solaris 11. References: Old description:
|
| Comments |
| Comment by auto [ 18/Jul/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}Message: | ||||||||||||||||||||||
| Comment by auto [ 18/Jul/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: backtrace_symbols() returns a block of strings, each containing a backtrace_symbols_fd() writes a stack trace to a specified file | ||||||||||||||||||||||
| Comment by auto [ 18/Jul/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: backtrace() fills a buffer provided by the caller with addresses | ||||||||||||||||||||||
| Comment by auto [ 18/Jul/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: Do not make direct calls to backtrace, backtrace_symbols or backtrace_symbols_fd, | ||||||||||||||||||||||
| Comment by auto [ 28/Jun/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}Message: | ||||||||||||||||||||||
| Comment by Andy Schwerin [ 28/Jun/13 ] | ||||||||||||||||||||||
|
Breaks client tarball. | ||||||||||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 28/Jun/13 ] | ||||||||||||||||||||||
|
I think https://github.com/mongodb/mongo/commit/54f25e6292eb565d4eadec1d5d75d286c787c053 broke the "client tarball" build of the C++ client driver on OS X:
I think the problem is that the tarball SConstruct file doesn't have the configure test for backtrace and friends so MONGO_HAVE_EXECINFO_BACKTRACE isn't defined, and we try to fall back to the emulations, however they don't build on OS X (and, really, shouldn't be used, since OS X does offer the real BSD backtrace routines). | ||||||||||||||||||||||
| Comment by auto [ 25/Jun/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: backtrace_symbols() returns a block of strings, each containing a backtrace_symbols_fd() writes a stack trace to a specified file | ||||||||||||||||||||||
| Comment by auto [ 21/Jun/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: backtrace() fills a buffer provided by the caller with addresses | ||||||||||||||||||||||
| Comment by auto [ 20/Jun/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: Branch: master | ||||||||||||||||||||||
| Comment by auto [ 20/Jun/13 ] | ||||||||||||||||||||||
|
Author: {u'username': u'tadmarshall', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: Do not make direct calls to backtrace, backtrace_symbols or backtrace_symbols_fd, | ||||||||||||||||||||||
| Comment by Tad Marshall [ 23/May/13 ] | ||||||||||||||||||||||
|
backtrace works in Oracle Solaris 11.1, at least for a build created on Solaris 11.1. Reports seem to indicate that it does not work in Solaris 10, but I don't have one to test. | ||||||||||||||||||||||
| Comment by Eric Milkie [ 25/Sep/12 ] | ||||||||||||||||||||||
|
I tried getting a backtrace using our MongoDB test program and it works on Nexenta OS (a defunct OpenSolaris derivative) as well as on SmartOS. | ||||||||||||||||||||||
| Comment by Eric Milkie [ 21/Sep/12 ] | ||||||||||||||||||||||
|
We do have the 32bit Solaris VM. I am working to get that running again. |