Commit b984794
fix: cloudwatch control message makes consumelogs crash with sigsegv (#44231)
#### Description
With following config:
```
receivers:
awss3:
s3downloader:
region: "ca-central-1"
s3_bucket: "<redacted>"
encodings:
- extension: awslogs_encoding/cloudwatch
sqs:
queue_url: "<redacted>"
region: "ca-central-1"
exporters:
nop:
service:
extensions: [awslogs_encoding/cloudwatch]
pipelines:
logs/aws:
receivers: [awss3]
processors: []
exporters: [ nop ]
extensions:
awslogs_encoding/cloudwatch:
format: cloudwatch
```
And this kind of message in the bucket (gzip in bucket btw)
```
{
"messageType": "CONTROL_MESSAGE",
"owner": "CloudwatchLogs",
"logGroup": "",
"logStream": "",
"subscriptionFilters": [],
"logEvents": [
{
"id": "",
"timestamp": 1763029869851,
"message": "CWL CONTROL MESSAGE: Checking health of destination Firehose."
}
]
}{
"messageType": "DATA_MESSAGE",
"owner": "0000000000000",
"logGroup": "/this/is/a/log/group",
"logStream": "this-is-a-log-stream",
"subscriptionFilters": [
"EksToS3"
],
"logEvents": [
{
"id": "000000000000011111111111111111122222222222222222233333333333333333",
"timestamp": 1763029869386,
"message": "dummy message",
"extractedFields": {
"@aws.account": "0000000000000",
"@aws.region": "ca-central-1"
}
}
]
}
```
I got the following issue
```
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4 pc=0xbbac4a]
goroutine 125 [running]:
go.opentelemetry.io/collector/pdata/internal.(*State).IsReadOnly(...)
go.opentelemetry.io/collector/[email protected]/internal/state.go:53
go.opentelemetry.io/collector/pdata/plog.Logs.IsReadOnly(...)
go.opentelemetry.io/collector/[email protected]/plog/logs.go:13
go.opentelemetry.io/collector/internal/fanoutconsumer.(*logsConsumer).ConsumeLogs(0xc000645260, {0x2d23670, 0xc0005760a0}, {0x0?, 0x0?})
go.opentelemetry.io/collector/internal/[email protected]/logs.go:61 +0x1ea
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver.(*logsReceiver).processReceivedData(0xc000446590, {0x2d23670, 0xc0005760a0}, 0xc000280a20, {0xc0001d7860, 0x57}, {0xc001578000, 0x9b07c, 0xac000})
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:262 +0x6c7
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver.(*awss3Receiver).receiveBytes(0xc000280a20, {0x2d23670, 0xc0005760a0}, {0xc0001d7860, 0x57}, {0xc001578000, 0x9b07c, 0xac000})
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:138 +0x253
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver.(*s3SQSNotificationReader).readAll(0xc000572ae0, {0x2d23670, 0xc0005760a0}, {0x2d70d98?, 0x23233c0?}, 0xc000518000)
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/s3sqsreader.go:208 +0x1939
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver.(*awss3Receiver).Start.func1()
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:106 +0x8a
created by github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver.(*awss3Receiver).Start in goroutine 1
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/[email protected]/receiver.go:105 +0x14c
```
Changing to proper logs initialization fix the issue
---------
Signed-off-by: Jean-Yves NOLEN <[email protected]>
Co-authored-by: Alex Boten <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Christos Markou <[email protected]>1 parent 6968a70 commit b984794
File tree
5 files changed
+49
-1
lines changed- .chloggen
- extension/encoding/awslogsencodingextension/internal/unmarshaler/subscription-filter
- testdata
5 files changed
+49
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
0 commit comments