1MONGOC_BASIC_TROUBLESHOOTING(3)MongoDB C DriverMONGOC_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
31 developers 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 supporting
40 shared memory segments. On supported platforms they are enabled by
41 default. Applications can be built without the counters by specifying
42 the cmake option -DENABLE_SHM_COUNTERS=OFF. Additionally, if perfor‐
43 mance counters are already compiled, they can be disabled at runtime by
44 specifying the environment variable MONGOC_DISABLE_SHM.
45
46 Performance counters keep track of the following:
47
48 · Active and Disposed Cursors
49
50 · Active and Disposed Clients, Client Pools, and Socket Streams.
51
52 · Number of operations sent and received, by type.
53
54 · Bytes transferred and received.
55
56 · Authentication successes and failures.
57
58 · Number of wire protocol errors.
59
60 To access counters for a given process, simply provide the process id
61 to the mongoc-stat program installed with the MongoDB C Driver.
62
63 $ mongoc-stat 22203
64 Operations : Egress Total : The number of sent operations. : 13247
65 Operations : Ingress Total : The number of received operations. : 13246
66 Operations : Egress Queries : The number of sent Query operations. : 13247
67 Operations : Ingress Queries : The number of received Query operations. : 0
68 Operations : Egress GetMore : The number of sent GetMore operations. : 0
69 Operations : Ingress GetMore : The number of received GetMore operations. : 0
70 Operations : Egress Insert : The number of sent Insert operations. : 0
71 Operations : Ingress Insert : The number of received Insert operations. : 0
72 Operations : Egress Delete : The number of sent Delete operations. : 0
73 Operations : Ingress Delete : The number of received Delete operations. : 0
74 Operations : Egress Update : The number of sent Update operations. : 0
75 Operations : Ingress Update : The number of received Update operations. : 0
76 Operations : Egress KillCursors : The number of sent KillCursors operations. : 0
77 Operations : Ingress KillCursors : The number of received KillCursors operations. : 0
78 Operations : Egress Msg : The number of sent Msg operations. : 0
79 Operations : Ingress Msg : The number of received Msg operations. : 0
80 Operations : Egress Reply : The number of sent Reply operations. : 0
81 Operations : Ingress Reply : The number of received Reply operations. : 13246
82 Cursors : Active : The number of active cursors. : 1
83 Cursors : Disposed : The number of disposed cursors. : 13246
84 Clients : Active : The number of active clients. : 1
85 Clients : Disposed : The number of disposed clients. : 0
86 Streams : Active : The number of active streams. : 1
87 Streams : Disposed : The number of disposed streams. : 0
88 Streams : Egress Bytes : The number of bytes sent. : 794931
89 Streams : Ingress Bytes : The number of bytes received. : 589694
90 Streams : N Socket Timeouts : The number of socket timeouts. : 0
91 Client Pools : Active : The number of active client pools. : 1
92 Client Pools : Disposed : The number of disposed client pools. : 0
93 Protocol : Ingress Errors : The number of protocol errors on ingress. : 0
94 Auth : Failures : The number of failed authentication requests. : 0
95 Auth : Success : The number of successful authentication requests. : 0
96
98 Think you've found a bug? Want to see a new feature in the MongoDB C
99 driver? Please open a case in our issue management tool, JIRA:
100
101 · Create an account and login.
102
103 · Navigate to the CDRIVER project.
104
105 · Click Create Issue - Please provide as much information as possible
106 about the issue type and how to reproduce it.
107
108 Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP,
109 JAVA) and the Core Server (i.e. SERVER) project are public.
110
112 MongoDB, Inc
113
115 2017-present, MongoDB, Inc
116
117
118
119
1201.15.2 Nov 06, 2019 MONGOC_BASIC_TROUBLESHOOTING(3)