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 valgrind show any leaks? Ensure you call mongoc_cleanup() at the
22 end of your process to cleanup lingering allocations from the MongoDB
23 C 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 unique feature to help de‐
31 velopers and sysadmins troubleshoot problems in production. Perfor‐
32 mance counters are available for each process using the driver. If
33 available, the counters can be accessed outside of the application
34 process via a shared memory segment. This means that you can graph
35 statistics about your application process easily from tools like Munin
36 or Nagios. Your author often uses watch --interval=0.5 -d mongoc-stat
37 $PID to monitor an application.
38
39 Performance counters are only available on Linux platforms and macOS
40 arm64 platforms supporting shared memory segments. On supported plat‐
41 forms they are enabled by default. Applications can be built without
42 the counters by specifying the cmake option -DENABLE_SHM_COUNTERS=OFF.
43 Additionally, if performance counters are already compiled, they can be
44 disabled at runtime by specifying the environment variable MONGOC_DIS‐
45 ABLE_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 To access counters for a given process, simply provide the process id
62 to the mongoc-stat program installed with the MongoDB C Driver.
63
64 $ mongoc-stat 22203
65 Operations : Egress Total : The number of sent operations. : 13247
66 Operations : Ingress Total : The number of received operations. : 13246
67 Operations : Egress Queries : The number of sent Query operations. : 13247
68 Operations : Ingress Queries : The number of received Query operations. : 0
69 Operations : Egress GetMore : The number of sent GetMore operations. : 0
70 Operations : Ingress GetMore : The number of received GetMore operations. : 0
71 Operations : Egress Insert : The number of sent Insert operations. : 0
72 Operations : Ingress Insert : The number of received Insert operations. : 0
73 Operations : Egress Delete : The number of sent Delete operations. : 0
74 Operations : Ingress Delete : The number of received Delete operations. : 0
75 Operations : Egress Update : The number of sent Update operations. : 0
76 Operations : Ingress Update : The number of received Update operations. : 0
77 Operations : Egress KillCursors : The number of sent KillCursors operations. : 0
78 Operations : Ingress KillCursors : The number of received KillCursors operations. : 0
79 Operations : Egress Msg : The number of sent Msg operations. : 0
80 Operations : Ingress Msg : The number of received Msg operations. : 0
81 Operations : Egress Reply : The number of sent Reply operations. : 0
82 Operations : Ingress Reply : The number of received Reply operations. : 13246
83 Cursors : Active : The number of active cursors. : 1
84 Cursors : Disposed : The number of disposed cursors. : 13246
85 Clients : Active : The number of active clients. : 1
86 Clients : Disposed : The number of disposed clients. : 0
87 Streams : Active : The number of active streams. : 1
88 Streams : Disposed : The number of disposed streams. : 0
89 Streams : Egress Bytes : The number of bytes sent. : 794931
90 Streams : Ingress Bytes : The number of bytes received. : 589694
91 Streams : N Socket Timeouts : The number of socket timeouts. : 0
92 Client Pools : Active : The number of active client pools. : 1
93 Client Pools : Disposed : The number of disposed client pools. : 0
94 Protocol : Ingress Errors : The number of protocol errors on ingress. : 0
95 Auth : Failures : The number of failed authentication requests. : 0
96 Auth : Success : The number of successful authentication requests. : 0
97
99 Think you've found a bug? Want to see a new feature in the MongoDB C
100 driver? Please open a case in our issue management tool, JIRA:
101
102 • Create an account and login.
103
104 • Navigate to the CDRIVER project.
105
106 • Click Create Issue - Please provide as much information as possible
107 about the issue type and how to reproduce it.
108
109 Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP,
110 JAVA) and the Core Server (i.e. SERVER) project are public.
111
113 MongoDB, Inc
114
116 2017-present, MongoDB, Inc
117
118
119
120
1211.21.1 Mar 02, 2022 MONGOC_BASIC_TROUBLESHOOTING(3)