문제 해결 체크리스트
다음은 문제가 발생할 때 확인해야 할 사항에 대한 간단한 목록입니다.
- mongoc_init()에서 을(를)- main()호출했습니까? 그렇지 않으면 segfault가 표시될 수 있습니다.
- mongoc-stat <PID>에서 찾을 수 있는 클라이언트나 커서가 유출되었나요?
- 패킷이 서버 로 전달되었습니까? - mongoc-stat <PID>의 송신 바이트를 확인합니다.
- ASAN에 누수가 표시되나요? 프로세스가 끝날 때- mongoc_cleanup()를 호출하여 MongoDB C 드라이버에서 느린 할당을 정리해야 합니다.
- 자체 MongoDB C 드라이버 사본을 컴파일하는 경우 cmake 옵션 - -DENABLE_TRACING=ON을 활성화 하여- STDERR및- STDOUT에 대한 네트워크 패킷의 함수 추적 및 16진수 덤프를 활성화하는 것이 좋습니다.
성능 카운터
MongoDB C 드라이버 에는 개발자와 시스템 관리자가 프로덕션에서 발생하는 문제를 해결하는 데 도움이 되는 선택적 고유 기능 이 함께 제공됩니다. 성능 카운터는 C 드라이버 를 사용하는 각 프로세스 에 사용할 수 있습니다. 사용 가능한 경우 카운터는 애플리케이션 프로세스 외부에서 공유 메모리 세그먼트를 통해 액세스할 수 있습니다. 카운터는 Munin 또는 Nagios와 같은 도구에서 애플리케이션 프로세스 에 대한 통계를 쉽게 그래프 로 표시할 수 있습니다. 예를 예시 , watch --interval=0.5 -d mongoc-stat $PID 명령은 애플리케이션 을 모니터 하는 데 사용할 수 있습니다.
성능 카운터는 공유 메모리 세그먼트를 지원하는 Linux 플랫폼 및 macOS arm64 플랫폼에서만 사용할 수 있습니다. 지원되는 플랫폼에서는 기본적으로 활성화되어 있습니다. cmake 옵션 -DENABLE_SHM_COUNTERS=OFF 을 지정하여 카운터 없이 애플리케이션을 빌드할 수 있습니다. 또한 성능 카운터가 이미 컴파일된 경우 런타임에 환경 변수 MONGOC_DISABLE_SHM 를 지정하여 비활성화할 수 있습니다.
성능 카운터는 다음을 추적 합니다.
- 활성 커서 및 삭제된 커서 
- 활성 및 폐기된 클라이언트, 클라이언트 풀, 소켓 스트림. 
- 유형별 전송 및 수신된 작업 수입니다. 
- 전송 및 수신된 바이트 수입니다. 
- 인증 성공 및 실패. 
- 유선 프로토콜 오류 수입니다. 
참고
작업은 전체 메시지가 성공적으로 작성되었는지 여부나 작업이 궁극적으로 성공하거나 실패하는지 여부에 관계없이 해당 메시지의 하나 이상의 바이트가 스트림 에 기록되면 '전송'된 것으로 간주됩니다. 여기에는 TLS 핸드셰이크 메시지와 같이 스트림 연결 프로세스 중에 기록될 수 있는 바이트는 포함되지 않습니다.
특정 프로세스 의 카운터에 액세스 하려면 MongoDB C 드라이버 와 함께 설치된 mongoc-stat 프로그램에 프로세스 ID를 제공하기만 하면 됩니다.
$ mongoc-stat 22203    Operations : Egress Total        : The number of sent operations.                    : 13247    Operations : Ingress Total       : The number of received operations.                : 13246    Operations : Egress Queries      : The number of sent Query operations.              : 13247    Operations : Ingress Queries     : The number of received Query operations.          : 0    Operations : Egress GetMore      : The number of sent GetMore operations.            : 0    Operations : Ingress GetMore     : The number of received GetMore operations.        : 0    Operations : Egress Insert       : The number of sent Insert operations.             : 0    Operations : Ingress Insert      : The number of received Insert operations.         : 0    Operations : Egress Delete       : The number of sent Delete operations.             : 0    Operations : Ingress Delete      : The number of received Delete operations.         : 0    Operations : Egress Update       : The number of sent Update operations.             : 0    Operations : Ingress Update      : The number of received Update operations.         : 0    Operations : Egress KillCursors  : The number of sent KillCursors operations.        : 0    Operations : Ingress KillCursors : The number of received KillCursors operations.    : 0    Operations : Egress Msg          : The number of sent Msg operations.                : 0    Operations : Ingress Msg         : The number of received Msg operations.            : 0    Operations : Egress Reply        : The number of sent Reply operations.              : 0    Operations : Ingress Reply       : The number of received Reply operations.          : 13246       Cursors : Active              : The number of active cursors.                     : 1       Cursors : Disposed            : The number of disposed cursors.                   : 13246       Clients : Active              : The number of active clients.                     : 1       Clients : Disposed            : The number of disposed clients.                   : 0       Streams : Active              : The number of active streams.                     : 1       Streams : Disposed            : The number of disposed streams.                   : 0       Streams : Egress Bytes        : The number of bytes sent.                         : 794931       Streams : Ingress Bytes       : The number of bytes received.                     : 589694       Streams : N Socket Timeouts   : The number of socket timeouts.                    : 0  Client Pools : Active              : The number of active client pools.                : 1  Client Pools : Disposed            : The number of disposed client pools.              : 0      Protocol : Ingress Errors      : The number of protocol errors on ingress.         : 0          Auth : Failures            : The number of failed authentication requests.     : 0          Auth : Success             : The number of successful authentication requests. : 0 
버그 보고서 제출
버그를 발견했다고 생각하시나요? MongoDB C 운전자 의 새로운 기능 을 보고 싶으신가요? 문제 관리 도구인 JIRA에서 사례를 제출하세요.
- CDRIVER 프로젝트 로 이동합니다. 
- 이슈 생성 을 클릭합니다 - 이슈 유형 및 이슈 재현 방법에 대한 최대한 많은 정보를 제공하세요. 
모든 운전자 프로젝트에 대한 JIRA의 버그 보고서(예: CDRIVER, C#, Java) 및 코어 서버(예: SERVER) 프로젝트 를 공개 합니다.