|
| 1 | +{ |
| 2 | + "files": [ |
| 3 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 4 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java", |
| 5 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java", |
| 6 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java", |
| 7 | + "clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java" |
| 8 | + ], |
| 9 | + "symbols": [ |
| 10 | + { |
| 11 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 12 | + "symbol": "Sender.sendProducerData", |
| 13 | + "repo": null |
| 14 | + }, |
| 15 | + { |
| 16 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 17 | + "symbol": "Sender.failBatch", |
| 18 | + "repo": null |
| 19 | + }, |
| 20 | + { |
| 21 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 22 | + "symbol": "Sender.maybeRemoveAndDeallocateBatch", |
| 23 | + "repo": null |
| 24 | + }, |
| 25 | + { |
| 26 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 27 | + "symbol": "Sender.sendProduceRequest", |
| 28 | + "repo": null |
| 29 | + }, |
| 30 | + { |
| 31 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java", |
| 32 | + "symbol": "ProducerBatch.records", |
| 33 | + "repo": null |
| 34 | + }, |
| 35 | + { |
| 36 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java", |
| 37 | + "symbol": "BufferPool.deallocate", |
| 38 | + "repo": null |
| 39 | + }, |
| 40 | + { |
| 41 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java", |
| 42 | + "symbol": "RecordAccumulator.deallocate", |
| 43 | + "repo": null |
| 44 | + } |
| 45 | + ], |
| 46 | + "expected_edit_files": [ |
| 47 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 48 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java", |
| 49 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java" |
| 50 | + ], |
| 51 | + "expected_edit_files_source": "curator_agent_inference", |
| 52 | + "expected_edit_files_confidence": "medium", |
| 53 | + "chunks": [ |
| 54 | + { |
| 55 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 56 | + "line_start": 357, |
| 57 | + "line_end": 443, |
| 58 | + "annotation": "sendProducerData(): Drains batches, checks for expired batches, and sends produce requests. Critical section where batches are added to in-flight and then immediately sent, but expiration/deallocation can occur before network write completes." |
| 59 | + }, |
| 60 | + { |
| 61 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 62 | + "line_start": 405, |
| 63 | + "line_end": 423, |
| 64 | + "annotation": "getExpiredInflightBatches() and expiredBatches() are called AFTER sendProduceRequests() collates batches but BEFORE actually sending them via client.send(). This creates the race condition window." |
| 65 | + }, |
| 66 | + { |
| 67 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 68 | + "line_start": 817, |
| 69 | + "line_end": 837, |
| 70 | + "annotation": "failBatch() with maybeRemoveAndDeallocateBatch() at line 835 - This deallocates the batch buffer while the batch may still have in-flight requests in the network layer." |
| 71 | + }, |
| 72 | + { |
| 73 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 74 | + "line_start": 172, |
| 75 | + "line_end": 175, |
| 76 | + "annotation": "maybeRemoveAndDeallocateBatch() - Calls accumulator.deallocate() which returns the ByteBuffer to the pool immediately, even though the request may still be serializing/sending on the network." |
| 77 | + }, |
| 78 | + { |
| 79 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java", |
| 80 | + "line_start": 864, |
| 81 | + "line_end": 916, |
| 82 | + "annotation": "sendProduceRequest() - Extracts MemoryRecords from batch at line 874, which holds a reference to the underlying ByteBuffer. The request is sent but the reference to the buffer is not retained." |
| 83 | + }, |
| 84 | + { |
| 85 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java", |
| 86 | + "line_start": 480, |
| 87 | + "line_end": 482, |
| 88 | + "annotation": "records() method - Returns MemoryRecords wrapping the ByteBuffer from recordsBuilder. This is the object used in the network request, and its underlying buffer can be deallocated while the request is in-flight." |
| 89 | + }, |
| 90 | + { |
| 91 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java", |
| 92 | + "line_start": 540, |
| 93 | + "line_end": 542, |
| 94 | + "annotation": "buffer() method - Exposes the underlying ByteBuffer that can be deallocated. ProducerBatch needs to track if its buffer is in-flight." |
| 95 | + }, |
| 96 | + { |
| 97 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java", |
| 98 | + "line_start": 260, |
| 99 | + "line_end": 275, |
| 100 | + "annotation": "deallocate() method - Returns buffers to the free pool for reuse. Called while the original batch's request may still be in-flight, causing buffer reuse corruption." |
| 101 | + }, |
| 102 | + { |
| 103 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java", |
| 104 | + "line_start": 264, |
| 105 | + "line_end": 265, |
| 106 | + "annotation": "buffer.clear() and free.add(buffer) - The buffer is immediately available for reuse, creating the race condition window." |
| 107 | + }, |
| 108 | + { |
| 109 | + "file": "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java", |
| 110 | + "line_start": 1027, |
| 111 | + "line_end": 1033, |
| 112 | + "annotation": "deallocate() method - Calls free.deallocate() which immediately makes the buffer available for reuse, without checking if the request is still in-flight." |
| 113 | + } |
| 114 | + ], |
| 115 | + "dependency_chain": [ |
| 116 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:sendProducerData()", |
| 117 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:sendProduceRequests()", |
| 118 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:sendProduceRequest()", |
| 119 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java:records()", |
| 120 | + "clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java", |
| 121 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:getExpiredInflightBatches()", |
| 122 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:failBatch()", |
| 123 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java:maybeRemoveAndDeallocateBatch()", |
| 124 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java:deallocate()", |
| 125 | + "clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java:deallocate()" |
| 126 | + ] |
| 127 | +} |
0 commit comments