평화로운 금요일 오후 찾아온 kafka produce 장애

Matthew Woo·2024년 9월 1일
0

Work

목록 보기
2/5

주말에는 대응이 어렵다보니 버즈빌은 금요일은 핫픽스가 아닌 이상 배포하지 않는 정책을 운영중이다.
오전에 전사에 두 건의 배포만 있었는데 오후부터 아래와 같은 에러들이 발생하기 시작했다.
카프카 produce 를 위해 Avro binary format으로 Serializes 하는 도중에 발생한 에러였다.

 ValueError: {'first': 2147638521, 'second': 0, 'service_type': 0} (type <class 'dict'>) 
 do not match [{'type': 'record', 'name': 'EncodedTransactionId', 'fields': [{'name': 'first', 'type': 'int'}, {'name': 'second', 'type': 'int'}, {'name': 'service_type', 'type': 'int'}]}, 'null'] on field encoded_transaction_id
 
 File "fastavro/_write.pyx", line 402, in fastavro._write.write_record
  File "fastavro/_write.pyx", line 456, in fastavro._write.write_data
  File "fastavro/_write.pyx", line 336, in fastavro._write.write_union

관련 코드나 변경사항 등의 문제도 없었다. Serialize 나 스키마 관리까지 confluent-kafka-python 라이브러리 코드를 사용하고 있다보니 confluent-kafka-python와 confluent-kafka-python 내에서 사용하는 라이브러리까지 이슈나 변경사항들에서도 찾을 수 없었다.

# dummy.avsc (사용하고 있던 스키마)
{
    "type": "record",
    "name": "PostbackDoneEvent",
    "fields": [
        
        ...
        
        {
            "name": "encoded_transaction_id",
            "type": [
                {
                    "type": "record",
                    "name": "EncodedTransactionId",
                    "fields": [
                        {
                            "name": "first",
                            "type": "int"
                        },
                        {
                            "name": "second",
                            "type": "int"
                        },
                        {
                            "name": "service_type",
                            "type": "int"
                        }
                    ]
                },
                "null"
            ]
        },
        
        ...
        
    ]
}

스키마도 변경이 없었는데 힌트는 에러메세지에 있긴 했다. ValueError ..
first 로 들어오는 값이 mysql int64 auto incr pk로 생성되는 값이었으나 schema 에는 int로 타입이 지정되어있었고 값이 범위를 넘어가기 시작했던 것이었다.

에러 문구가 직관적이지 않았던 부분이 아쉬워서 관련 오픈소스에 issue에 건의드렸다. (https://github.com/fastavro/fastavro/issues/794)

관련 코드: https://github.com/fastavro/fastavro/blob/master/fastavro/_write.pyx#L335-L339


이후.. 위 케이스에서 보다 명시적인 error return을 위해서 오픈소스에 기여해볼 기회이다 싶어서 두개의 PR을 올렸었다.

https://github.com/fastavro/fastavro/pull/813
https://github.com/fastavro/fastavro/pull/801

헌데 리뷰가 안된 상태로 꽤 오랜 시간 방치되다가 issue에 Status of this repo 라는 새로운 이슈가 올라왔다.

https://github.com/fastavro/fastavro/issues/817

컨트리뷰터 분이 더 이상 관리할 여력이 안된다고 리뷰를 더이상 받지 못하는 상황..

나의 첫 오픈소스 기여 기회가 이렇게 무산되었다.. 다시 돌아오시길 기원하며..

profile
지속가능하고 안정적인 시스템을 만들고자 합니다.

0개의 댓글