Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logstash source): Fix typo causing a panic on short requests #21286

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Sep 12, 2024

The sources mistakenly check the original request instead of the current offset to ensure there are enough bytes left when extracting integers in two places. This can cause a panic in the bytes::Buf code if requests are cut off in the middle of those integers.

NOTE: This contains a large refactor to the frame decoder just to change two lines and test them. Best viewed with "Hide whitespace" enabled.

The sources mistakenly check the original request instead of the current offset
to ensure there are enough bytes left when extracting integers in two places.
This can cause a panic in the `bytes::Buf` code if requests are cut off in the
middle of those integers.
@bruceg bruceg added type: bug A code related bug. source: logstash Anything `logstash` source related labels Sep 12, 2024
@github-actions github-actions bot added the domain: sources Anything related to the Vector's sources label Sep 12, 2024
@bruceg bruceg requested a review from pront September 12, 2024 18:46
@bruceg bruceg marked this pull request as ready for review September 12, 2024 18:46
@bruceg bruceg requested a review from a team as a code owner September 12, 2024 18:46
@datadog-vectordotdev
Copy link

datadog-vectordotdev bot commented Sep 12, 2024

Datadog Report

Branch report: bruceg/fix-logstash-panic
Commit report: 286d462
Test service: vector

✅ 0 Failed, 9 Passed, 0 Skipped, 29.5s Total Time

Copy link
Contributor

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks much better now.

@bruceg bruceg added this pull request to the merge queue Sep 12, 2024
Copy link

Regression Detector Results

Run ID: c53ab603-815a-41dc-87de-afa8f65f949a Metrics dashboard

Baseline: 9f56d46
Comparison: 55bd779

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

Significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +6.58 [+6.45, +6.71]
otlp_http_to_blackhole ingress throughput -5.36 [-5.48, -5.24]

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput -8.04 [-15.03, -1.05]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +6.58 [+6.45, +6.71]
splunk_hec_route_s3 ingress throughput +2.38 [+2.06, +2.69]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +1.79 [+1.68, +1.91]
http_elasticsearch ingress throughput +1.13 [+0.92, +1.34]
syslog_humio_logs ingress throughput +0.82 [+0.72, +0.93]
syslog_splunk_hec_logs ingress throughput +0.41 [+0.31, +0.51]
datadog_agent_remap_blackhole ingress throughput +0.32 [+0.20, +0.44]
syslog_log2metric_splunk_hec_metrics ingress throughput +0.23 [+0.11, +0.35]
http_to_http_noack ingress throughput +0.12 [+0.05, +0.19]
http_to_http_json ingress throughput +0.07 [+0.02, +0.12]
datadog_agent_remap_blackhole_acks ingress throughput +0.01 [-0.09, +0.12]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.01 [-0.09, +0.11]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.09, +0.10]
splunk_hec_indexer_ack_blackhole ingress throughput -0.01 [-0.09, +0.07]
datadog_agent_remap_datadog_logs_acks ingress throughput -0.15 [-0.34, +0.05]
fluent_elasticsearch ingress throughput -0.24 [-0.73, +0.25]
datadog_agent_remap_datadog_logs ingress throughput -0.25 [-0.42, -0.08]
http_to_s3 ingress throughput -0.25 [-0.53, +0.03]
otlp_grpc_to_blackhole ingress throughput -0.35 [-0.47, -0.24]
syslog_loki ingress throughput -0.56 [-0.64, -0.48]
http_to_http_acks ingress throughput -0.72 [-1.94, +0.50]
syslog_log2metric_humio_metrics ingress throughput -0.89 [-1.01, -0.76]
socket_to_socket_blackhole ingress throughput -2.85 [-2.92, -2.77]
http_text_to_http_json ingress throughput -3.04 [-3.16, -2.91]
otlp_http_to_blackhole ingress throughput -5.36 [-5.48, -5.24]
file_to_blackhole egress throughput -8.04 [-15.03, -1.05]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 12, 2024
@bruceg bruceg added this pull request to the merge queue Sep 12, 2024
Copy link

Regression Detector Results

Run ID: eb6543bf-e7d0-41fc-9649-67755f37c458 Metrics dashboard

Baseline: 9f56d46
Comparison: 576f57e

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

Significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

perf experiment goal Δ mean % Δ mean % CI links
otlp_http_to_blackhole ingress throughput -5.21 [-5.34, -5.08]

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput +27.03 [+19.13, +34.93]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput +27.03 [+19.13, +34.93]
datadog_agent_remap_blackhole_acks ingress throughput +1.57 [+1.45, +1.70]
syslog_log2metric_humio_metrics ingress throughput +1.45 [+1.32, +1.58]
syslog_log2metric_splunk_hec_metrics ingress throughput +1.32 [+1.22, +1.42]
datadog_agent_remap_datadog_logs ingress throughput +1.10 [+0.86, +1.33]
fluent_elasticsearch ingress throughput +0.52 [+0.03, +1.02]
syslog_humio_logs ingress throughput +0.52 [+0.41, +0.64]
http_to_http_acks ingress throughput +0.50 [-0.72, +1.71]
http_to_http_noack ingress throughput +0.17 [+0.08, +0.25]
http_to_http_json ingress throughput +0.08 [+0.02, +0.14]
syslog_loki ingress throughput +0.04 [-0.04, +0.13]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.01 [-0.10, +0.13]
splunk_hec_to_splunk_hec_logs_noack ingress throughput -0.01 [-0.10, +0.08]
splunk_hec_indexer_ack_blackhole ingress throughput -0.01 [-0.09, +0.07]
datadog_agent_remap_datadog_logs_acks ingress throughput -0.31 [-0.51, -0.11]
otlp_grpc_to_blackhole ingress throughput -0.82 [-0.93, -0.71]
http_to_s3 ingress throughput -0.86 [-1.13, -0.59]
datadog_agent_remap_blackhole ingress throughput -1.04 [-1.15, -0.93]
syslog_regex_logs2metric_ddmetrics ingress throughput -1.34 [-1.47, -1.21]
syslog_splunk_hec_logs ingress throughput -1.57 [-1.66, -1.47]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -1.66 [-1.76, -1.57]
splunk_hec_route_s3 ingress throughput -1.74 [-2.05, -1.43]
socket_to_socket_blackhole ingress throughput -3.03 [-3.09, -2.97]
http_elasticsearch ingress throughput -3.10 [-3.28, -2.93]
http_text_to_http_json ingress throughput -4.22 [-4.34, -4.10]
otlp_http_to_blackhole ingress throughput -5.21 [-5.34, -5.08]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 12, 2024
@bruceg bruceg added this pull request to the merge queue Sep 12, 2024
Copy link

Regression Detector Results

Run ID: 0cd0cc9d-bd80-4cee-ae82-425b76e5a2cd Metrics dashboard

Baseline: 9f56d46
Comparison: 1137671

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

Significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

perf experiment goal Δ mean % Δ mean % CI links
otlp_http_to_blackhole ingress throughput -5.30 [-5.42, -5.18]

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput -20.53 [-26.63, -14.43]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +3.48 [+3.33, +3.62]
http_text_to_http_json ingress throughput +3.24 [+3.12, +3.36]
datadog_agent_remap_blackhole_acks ingress throughput +2.09 [+1.98, +2.20]
syslog_splunk_hec_logs ingress throughput +1.26 [+1.15, +1.38]
datadog_agent_remap_datadog_logs_acks ingress throughput +1.15 [+0.96, +1.33]
syslog_log2metric_splunk_hec_metrics ingress throughput +1.05 [+0.94, +1.17]
syslog_log2metric_humio_metrics ingress throughput +0.82 [+0.72, +0.92]
datadog_agent_remap_blackhole ingress throughput +0.69 [+0.58, +0.79]
http_elasticsearch ingress throughput +0.48 [+0.33, +0.64]
http_to_http_noack ingress throughput +0.17 [+0.09, +0.26]
http_to_http_acks ingress throughput +0.05 [-1.17, +1.27]
http_to_http_json ingress throughput +0.03 [-0.01, +0.08]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.02 [-0.07, +0.11]
splunk_hec_to_splunk_hec_logs_acks ingress throughput -0.00 [-0.13, +0.12]
splunk_hec_indexer_ack_blackhole ingress throughput -0.01 [-0.09, +0.07]
http_to_s3 ingress throughput -0.12 [-0.40, +0.16]
otlp_grpc_to_blackhole ingress throughput -0.17 [-0.29, -0.06]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput -0.22 [-0.32, -0.11]
fluent_elasticsearch ingress throughput -1.06 [-1.55, -0.57]
syslog_loki ingress throughput -1.46 [-1.53, -1.39]
syslog_humio_logs ingress throughput -1.70 [-1.83, -1.57]
datadog_agent_remap_datadog_logs ingress throughput -1.91 [-2.11, -1.71]
splunk_hec_route_s3 ingress throughput -3.00 [-3.31, -2.68]
socket_to_socket_blackhole ingress throughput -4.45 [-4.51, -4.39]
otlp_http_to_blackhole ingress throughput -5.30 [-5.42, -5.18]
file_to_blackhole egress throughput -20.53 [-26.63, -14.43]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 12, 2024
@bruceg bruceg added this pull request to the merge queue Sep 13, 2024
Copy link

Regression Detector Results

Run ID: 57de02eb-5351-41ca-a367-d671e8e95f71 Metrics dashboard

Baseline: 9f56d46
Comparison: e71016c

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI links
file_to_blackhole egress throughput -4.20 [-11.30, +2.90]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI links
syslog_regex_logs2metric_ddmetrics ingress throughput +3.00 [+2.87, +3.14]
datadog_agent_remap_blackhole_acks ingress throughput +1.68 [+1.58, +1.79]
syslog_loki ingress throughput +1.61 [+1.53, +1.69]
http_to_http_acks ingress throughput +1.55 [+0.33, +2.78]
fluent_elasticsearch ingress throughput +1.52 [+1.03, +2.02]
syslog_humio_logs ingress throughput +1.28 [+1.20, +1.37]
syslog_log2metric_tag_cardinality_limit_blackhole ingress throughput +0.68 [+0.58, +0.78]
datadog_agent_remap_datadog_logs_acks ingress throughput +0.29 [+0.11, +0.46]
http_to_http_noack ingress throughput +0.22 [+0.12, +0.32]
http_to_s3 ingress throughput +0.12 [-0.15, +0.40]
syslog_log2metric_splunk_hec_metrics ingress throughput +0.08 [-0.03, +0.19]
http_to_http_json ingress throughput +0.02 [-0.02, +0.07]
splunk_hec_indexer_ack_blackhole ingress throughput +0.02 [-0.06, +0.10]
splunk_hec_to_splunk_hec_logs_noack ingress throughput +0.01 [-0.09, +0.10]
splunk_hec_to_splunk_hec_logs_acks ingress throughput +0.00 [-0.11, +0.11]
http_elasticsearch ingress throughput -0.27 [-0.43, -0.10]
syslog_log2metric_humio_metrics ingress throughput -0.30 [-0.44, -0.17]
datadog_agent_remap_blackhole ingress throughput -0.36 [-0.46, -0.27]
otlp_grpc_to_blackhole ingress throughput -0.99 [-1.10, -0.88]
datadog_agent_remap_datadog_logs ingress throughput -1.00 [-1.23, -0.77]
splunk_hec_route_s3 ingress throughput -1.09 [-1.40, -0.79]
http_text_to_http_json ingress throughput -1.26 [-1.39, -1.13]
syslog_splunk_hec_logs ingress throughput -2.49 [-2.60, -2.38]
socket_to_socket_blackhole ingress throughput -2.99 [-3.04, -2.94]
otlp_http_to_blackhole ingress throughput -3.20 [-3.33, -3.07]
file_to_blackhole egress throughput -4.20 [-11.30, +2.90]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Merged via the queue into master with commit e71016c Sep 13, 2024
65 checks passed
@bruceg bruceg deleted the bruceg/fix-logstash-panic branch September 13, 2024 01:15
AndrooTheChen pushed a commit to discord/vector that referenced this pull request Sep 23, 2024
…tordotdev#21286)

* fix(logstash source): Fix typo causing a panic on short requests

The sources mistakenly check the original request instead of the current offset
to ensure there are enough bytes left when extracting integers in two places.
This can cause a panic in the `bytes::Buf` code if requests are cut off in the
middle of those integers.

* Fix clippy lints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: sources Anything related to the Vector's sources source: logstash Anything `logstash` source related type: bug A code related bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants