1MONGOC_BASIC_TROUBLESHOOTING(3) libmongoc MONGOC_BASIC_TROUBLESHOOTING(3)
2
3
4
6 mongoc_basic_troubleshooting - Basic Troubleshooting
7
9 The following is a short list of things to check when you have a prob‐
10 lem.
11
12 • Did you call mongoc_init() in main()? If not, you will likely see a
13 segfault.
14
15 • Have you leaked any clients or cursors as can be found with mon‐
16 goc-stat <PID>?
17
18 • Have packets been delivered to the server? See egress bytes from mon‐
19 goc-stat <PID>.
20
21 • Does ASAN show any leaks? Ensure you call mongoc_cleanup() at the end
22 of your process to cleanup lingering allocations from the MongoDB C
23 driver.
24
25 • If compiling your own copy of MongoDB C Driver, consider using the
26 cmake option -DENABLE_TRACING=ON to enable function tracing and hex
27 dumps of network packets to STDERR and STDOUT.
28
30 The MongoDB C Driver comes with an optional and unique feature to help
31 developers and sysadmins troubleshoot problems in production. Perfor‐
32 mance counters are available for each process using the C Driver. If
33 available, the counters can be accessed outside of the application
34 process via a shared memory segment. The counters may be used graph
35 statistics about your application process easily from tools like Munin
36 or Nagios. For example, the command watch --interval=0.5 -d mon‐
37 goc-stat $PID may be used to monitor an application.
38
39 Performance counters are only available on Linux platforms and macOS
40 arm64 platforms that support shared memory segments. On supported
41 platforms, they are enabled by default. Applications can be built
42 without the counters by specifying the cmake option -DENABLE_SHM_COUN‐
43 TERS=OFF. Additionally, if performance counters are already compiled,
44 they can be disabled at runtime by specifying the environment variable
45 MONGOC_DISABLE_SHM.
46
47 Performance counters keep track of the following:
48
49 • Active and Disposed Cursors
50
51 • Active and Disposed Clients, Client Pools, and Socket Streams.
52
53 • Number of operations sent and received, by type.
54
55 • Bytes transferred and received.
56
57 • Authentication successes and failures.
58
59 • Number of wire protocol errors.
60
61 NOTE:
62 An operation is considered "sent" when one or more bytes of the cor‐
63 responding message is written to the stream, regardless of whether
64 the entire message is successfully written or if the operation ulti‐
65 mately succeeds or fails. This does not include bytes that may be
66 written during the stream connection process, such as TLS handshake
67 messages.
68
69 To access counters for a given process, simply provide the process id
70 to the mongoc-stat program installed with the MongoDB C Driver.
71
72 $ mongoc-stat 22203
73 Operations : Egress Total : The number of sent operations. : 13247
74 Operations : Ingress Total : The number of received operations. : 13246
75 Operations : Egress Queries : The number of sent Query operations. : 13247
76 Operations : Ingress Queries : The number of received Query operations. : 0
77 Operations : Egress GetMore : The number of sent GetMore operations. : 0
78 Operations : Ingress GetMore : The number of received GetMore operations. : 0
79 Operations : Egress Insert : The number of sent Insert operations. : 0
80 Operations : Ingress Insert : The number of received Insert operations. : 0
81 Operations : Egress Delete : The number of sent Delete operations. : 0
82 Operations : Ingress Delete : The number of received Delete operations. : 0
83 Operations : Egress Update : The number of sent Update operations. : 0
84 Operations : Ingress Update : The number of received Update operations. : 0
85 Operations : Egress KillCursors : The number of sent KillCursors operations. : 0
86 Operations : Ingress KillCursors : The number of received KillCursors operations. : 0
87 Operations : Egress Msg : The number of sent Msg operations. : 0
88 Operations : Ingress Msg : The number of received Msg operations. : 0
89 Operations : Egress Reply : The number of sent Reply operations. : 0
90 Operations : Ingress Reply : The number of received Reply operations. : 13246
91 Cursors : Active : The number of active cursors. : 1
92 Cursors : Disposed : The number of disposed cursors. : 13246
93 Clients : Active : The number of active clients. : 1
94 Clients : Disposed : The number of disposed clients. : 0
95 Streams : Active : The number of active streams. : 1
96 Streams : Disposed : The number of disposed streams. : 0
97 Streams : Egress Bytes : The number of bytes sent. : 794931
98 Streams : Ingress Bytes : The number of bytes received. : 589694
99 Streams : N Socket Timeouts : The number of socket timeouts. : 0
100 Client Pools : Active : The number of active client pools. : 1
101 Client Pools : Disposed : The number of disposed client pools. : 0
102 Protocol : Ingress Errors : The number of protocol errors on ingress. : 0
103 Auth : Failures : The number of failed authentication requests. : 0
104 Auth : Success : The number of successful authentication requests. : 0
105
107 Think you've found a bug? Want to see a new feature in the MongoDB C
108 driver? Please open a case in our issue management tool, JIRA:
109
110 • Create an account and login.
111
112 • Navigate to the CDRIVER project.
113
114 • Click Create Issue - Please provide as much information as possible
115 about the issue type and how to reproduce it.
116
117 Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP,
118 JAVA) and the Core Server (i.e. SERVER) project are public.
119
121 MongoDB, Inc
122
124 2017-present, MongoDB, Inc
125
126
127
128
1291.24.3 Aug 17, 2023 MONGOC_BASIC_TROUBLESHOOTING(3)