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

Improve thread safety of fingerprint processor #18738

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

urso
Copy link

@urso urso commented May 25, 2020

  • Bug

What does this PR do?

Remove the reuse of the hash function between runs in the hash processor.

Running the benchmarks seems to suggest that we don't create any extra
allocations with this change (tested with go1.13):

$ go test -bench . -benchmem
goos: darwin
goarch: amd64
pkg: github.com/elastic/beats/v7/libbeat/processors/fingerprint
BenchmarkHashMethods/sha384-4         	1000000000	         0.123 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha512-4         	1000000000	         0.125 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/xxhash-4         	1000000000	         0.0539 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/md5-4            	1000000000	         0.0925 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha1-4           	1000000000	         0.112 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha256-4         	1000000000	         0.134 ns/op	       0 B/op	       0 allocs/op

Why is it important?

The fingerprint processor used to reuse state between calls, but not
being threadsafe means that the processor might get into an invalid
state if it is used by multiple go-routines by accident, creating
invalid, non-reproducible hash values. This change does not reuse the
hash state between runs.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
    - [ ] I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Related issues

@urso urso added bug review libbeat Team:Services (Deprecated) Label for the former Integrations-Services team labels May 25, 2020
@urso urso requested a review from ycombinator May 25, 2020 20:35
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 25, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 25, 2020

❕ Build Aborted

There is a new build on-going so the previous on-going builds have been aborted.

Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: [urso commented: jenkins please run tests.]

  • Reason: Aborted from #4

  • Start Time: 2020-05-26T12:33:28.309+0000

  • Duration: 72 min 32 sec

  • Commit: 944979d55fdbf9c21d7c59459658ccd6e30f7bfb

Test stats 🧪

Test Results
Failed 0
Passed 9246
Skipped 1542
Total 10788

Steps errors

Expand to view the steps failures

  • Name: Report to Codecov
    • Description: curl -sSLo codecov https://codecov.io/bash for i in auditbeat filebeat heartbeat libbeat metricbeat packetbeat winlogbeat journalbeat do FILE="${i}/build/coverage/full.cov" if [ -f "${FILE}" ]; then bash codecov -f "${FILE}" fi done

    • Duration: 2 min 22 sec

    • Start Time: 2020-05-26T13:41:27.604+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-05-26T13:44:29.606Z] + [ -f packetbeat/build/coverage/full.cov ]
[2020-05-26T13:44:29.606Z] + FILE=winlogbeat/build/coverage/full.cov
[2020-05-26T13:44:29.606Z] + [ -f winlogbeat/build/coverage/full.cov ]
[2020-05-26T13:44:29.606Z] + FILE=journalbeat/build/coverage/full.cov
[2020-05-26T13:44:29.606Z] + [ -f journalbeat/build/coverage/full.cov ]
[2020-05-26T13:44:30.562Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-05-26T13:44:30.905Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-05-26T13:44:30.925Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Lint
[2020-05-26T13:44:31.037Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-05-26T13:44:31.130Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-oss
[2020-05-26T13:44:31.232Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-05-26T13:44:31.409Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Dockerlogbeat
[2020-05-26T13:44:31.601Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-05-26T13:44:31.793Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Journalbeat-oss
[2020-05-26T13:44:31.935Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-05-26T13:44:32.088Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-05-26T13:44:32.257Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-05-26T13:44:32.424Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-05-26T13:44:32.631Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-05-26T13:44:32.880Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-05-26T13:44:33.074Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-05-26T13:44:33.248Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Heartbeat-oss
[2020-05-26T13:44:33.366Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-05-26T13:44:33.516Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-x-pack
[2020-05-26T13:44:33.738Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-05-26T13:44:33.931Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-05-26T13:44:34.115Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-Linux
[2020-05-26T13:44:34.251Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Heartbeat-Mac-OS-X
[2020-05-26T13:44:34.406Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-Windows
[2020-05-26T13:44:34.529Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-05-26T13:44:34.630Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Packetbeat-oss
[2020-05-26T13:44:34.735Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-05-26T13:44:34.975Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-05-26T13:44:35.132Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-05-26T13:44:35.244Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-Mac-OS-X
[2020-05-26T13:44:35.349Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Windows
[2020-05-26T13:44:35.440Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-05-26T13:44:35.536Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack
[2020-05-26T13:44:35.739Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-oss
[2020-05-26T13:44:35.862Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-05-26T13:44:35.971Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Heartbeat-Windows
[2020-05-26T13:44:36.065Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-05-26T13:44:36.160Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-Windows
[2020-05-26T13:44:36.254Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-oss
[2020-05-26T13:44:36.364Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Functionbeat-Windows
[2020-05-26T13:44:36.443Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-05-26T13:44:36.533Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-05-26T13:44:36.659Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-05-26T13:44:36.760Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-05-26T13:44:36.876Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-05-26T13:44:36.996Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-05-26T13:44:37.384Z] + cat
[2020-05-26T13:44:37.384Z] + /usr/local/bin/runbld ./runbld-script
[2020-05-26T13:44:37.384Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-05-26T13:44:43.988Z] runbld>>> runbld started
[2020-05-26T13:44:43.988Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-05-26T13:44:45.376Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18738' in order of occurrence in the config (last value wins).
[2020-05-26T13:44:46.762Z] runbld>>> Debug logging enabled.
[2020-05-26T13:44:46.762Z] runbld>>> Storing result
[2020-05-26T13:44:46.762Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-05-26T13:44:46.762Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200526134446-ADF56DBB
[2020-05-26T13:44:46.762Z] runbld>>> Adding system facts.
[2020-05-26T13:44:47.711Z] runbld>>> Adding vcs info for the latest commit:  45c44991408d9427e7b78c9074f7222b27ae3c20
[2020-05-26T13:44:47.711Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-05-26T13:44:47.711Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-05-26T13:44:47.976Z] Processing JUnit reports with runbld...
[2020-05-26T13:44:47.976Z] + echo 'Processing JUnit reports with runbld...'
[2020-05-26T13:44:48.246Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-05-26T13:44:48.246Z] runbld>>> DURATION: 22ms
[2020-05-26T13:44:48.246Z] runbld>>> STDOUT: 40 bytes
[2020-05-26T13:44:48.246Z] runbld>>> STDERR: 49 bytes
[2020-05-26T13:44:48.246Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-05-26T13:44:48.246Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-05-26T13:44:49.633Z] runbld>>> Storing build metadata: 
[2020-05-26T13:44:49.633Z] runbld>>> Adding test report.
[2020-05-26T13:44:49.633Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-05-26T13:44:50.587Z] runbld>>> Found 111 test output files
[2020-05-26T13:44:51.160Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-05-26T13:44:51.160Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-cloudfoundry.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-05-26T13:44:52.548Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-05-26T13:44:52.810Z] runbld>>> Test output logs contained: Errors: 0 Failures: 0 Tests: 10638 Skipped: 1304
[2020-05-26T13:44:53.070Z] runbld>>> Storing result
[2020-05-26T13:44:53.070Z] runbld>>> FAILURES: 0
[2020-05-26T13:44:53.332Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-05-26T13:44:53.332Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200526134446-ADF56DBB
[2020-05-26T13:44:53.332Z] runbld>>> Email notification disabled by environment variable.
[2020-05-26T13:44:53.332Z] runbld>>> Slack notification disabled by environment variable.
[2020-05-26T13:44:59.887Z] Running on worker-395930 in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738
[2020-05-26T13:45:00.013Z] [INFO] getVaultSecret: Getting secrets
[2020-05-26T13:45:00.089Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-05-26T13:45:02.175Z] + chmod 755 generate-build-data.sh
[2020-05-26T13:45:02.175Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3 ABORTED 4292421
[2020-05-26T13:45:02.175Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3/steps/?limit=10000 -o steps-info.json
[2020-05-26T13:45:04.473Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3/tests/?status=FAILED -o tests-errors.json
[2020-05-26T13:45:05.945Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3/log/ -o pipeline-log.txt

// The fields array must be sorted, to guarantee that we always
// get the same hash for a similar set of configured keys.
// The call `ToSlice` always returns a sorted slice.
fields := common.MakeStringSet(config.Fields...).ToSlice()
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, is there a difference in calling .ToSlice() here vs. how it was before, a few lines below? Either way the value of p.fields would be sorted, no? I'm just wondering if you are making this change to try and do all the operations on config.Fields in one place (this line) or if there's some other more fundamental reason that could prevent a bug or something else.

Copy link
Author

Choose a reason for hiding this comment

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

I just moved it here in order to 'cleanly' add the code comment. Operationally it makes no difference. It's not obvious that ToSlice already sorts and not immediately obvious that we always need the keys to be sorted, so we should document this (at first I thought we have a bug thanks to StringSet storing keys in randomized order).

Often I prefer to have fully 'initialized' variables that I don't need to modify or execute other operations on when constructing another object. This gives each code block a self-contained purpose (almost like a function).

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the change with not sharing the hash function to allow for concurrent use of this processor.

@urso
Copy link
Author

urso commented May 26, 2020

jenkins please run tests.

@urso
Copy link
Author

urso commented May 26, 2020

jenkins run tests

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 27, 2020

❕ Build Aborted

Either there was a build timeout or someone aborted the build.'}

Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: [Pull request #18738 updated]

  • Start Time: 2020-06-02T15:39:43.628+0000

  • Duration: 123 min 12 sec

Test stats 🧪

Test Results
Failed 6
Passed 8378
Skipped 1549
Total 9933

Test errors

Expand to view the tests failures

  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestFetch – channels

    • Age: 1
    • Duration: 49.42
    • Error Details: Failed
  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestFetch – stats

    • Age: 1
    • Duration: 12.19
    • Error Details: Failed
  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestFetch – subscriptions

    • Age: 1
    • Duration: 23.97
    • Error Details: Failed
  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestData – channels

    • Age: 4
    • Duration: 23.92
    • Error Details: Failed
  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestData – stats

    • Age: 4
    • Duration: 37.19
    • Error Details: Failed
  • Name: Build and Test / Metricbeat x-pack / Metricbeat x-pack / TestData – subscriptions

    • Age: 4
    • Duration: 37.41
    • Error Details: Failed

Steps errors

Expand to view the steps failures

  • Name: Mage build test
    • Description: mage build test

    • Duration: 29 min 18 sec

    • Start Time: 2020-06-02T16:40:19.552+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-06-02T17:42:29.183Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.cancel(TimeoutStepExecution.java:165)
[2020-06-02T17:42:29.183Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.access$100(TimeoutStepExecution.java:38)
[2020-06-02T17:42:29.183Z] 	at org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution$1.run(TimeoutStepExecution.java:139)
[2020-06-02T17:42:29.183Z] 	at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-06-02T17:42:29.183Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-06-02T17:42:29.183Z] 	at java.lang.Thread.run(Thread.java:748)
[2020-06-02T17:42:29.183Z] 
[2020-06-02T17:42:29.250Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-06-02T17:42:29.557Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-06-02T17:42:29.568Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Lint
[2020-06-02T17:42:29.657Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-06-02T17:42:29.724Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-oss
[2020-06-02T17:42:29.791Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-06-02T17:42:29.857Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Dockerlogbeat
[2020-06-02T17:42:29.923Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Journalbeat-oss
[2020-06-02T17:42:29.989Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-06-02T17:42:30.058Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-06-02T17:42:30.130Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-06-02T17:42:30.197Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Heartbeat-oss
[2020-06-02T17:42:30.267Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-06-02T17:42:30.340Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-06-02T17:42:30.407Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-06-02T17:42:30.475Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-06-02T17:42:30.543Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-x-pack
[2020-06-02T17:42:30.610Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-06-02T17:42:30.677Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-06-02T17:42:30.755Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-06-02T17:42:30.827Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-Windows
[2020-06-02T17:42:30.895Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-06-02T17:42:30.972Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Packetbeat-oss
[2020-06-02T17:42:31.053Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-06-02T17:42:31.124Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-06-02T17:42:31.192Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack
[2020-06-02T17:42:31.266Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-oss
[2020-06-02T17:42:31.340Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-06-02T17:42:31.411Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-06-02T17:42:31.480Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-oss
[2020-06-02T17:42:31.545Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-06-02T17:42:31.612Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-06-02T17:42:31.678Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-06-02T17:42:31.744Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Windows
[2020-06-02T17:42:31.810Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-06-02T17:42:31.877Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-06-02T17:42:31.948Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-06-02T17:42:32.021Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-06-02T17:42:32.087Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-06-02T17:42:32.154Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-06-02T17:42:32.226Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-06-02T17:42:32.294Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-06-02T17:42:32.646Z] + cat
[2020-06-02T17:42:32.646Z] + /usr/local/bin/runbld ./runbld-script
[2020-06-02T17:42:32.646Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-06-02T17:42:39.228Z] runbld>>> runbld started
[2020-06-02T17:42:39.228Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-06-02T17:42:40.610Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18738' in order of occurrence in the config (last value wins).
[2020-06-02T17:42:41.988Z] runbld>>> Debug logging enabled.
[2020-06-02T17:42:41.988Z] runbld>>> Storing result
[2020-06-02T17:42:41.988Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-06-02T17:42:41.988Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200602174241-D4C06DDC
[2020-06-02T17:42:41.988Z] runbld>>> Adding system facts.
[2020-06-02T17:42:42.926Z] runbld>>> Adding vcs info for the latest commit:  aba010afd423476232f618d66846a8e50c1d9ce3
[2020-06-02T17:42:42.926Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-06-02T17:42:43.185Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-06-02T17:42:43.185Z] Processing JUnit reports with runbld...
[2020-06-02T17:42:43.185Z] + echo 'Processing JUnit reports with runbld...'
[2020-06-02T17:42:43.444Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-06-02T17:42:43.444Z] runbld>>> DURATION: 16ms
[2020-06-02T17:42:43.444Z] runbld>>> STDOUT: 40 bytes
[2020-06-02T17:42:43.444Z] runbld>>> STDERR: 49 bytes
[2020-06-02T17:42:43.444Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-06-02T17:42:43.444Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-06-02T17:42:44.826Z] runbld>>> Storing build metadata: 
[2020-06-02T17:42:44.826Z] runbld>>> Adding test report.
[2020-06-02T17:42:44.826Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats
[2020-06-02T17:42:46.206Z] runbld>>> Found 105 test output files
[2020-06-02T17:42:46.206Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-06-02T17:42:46.467Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-06-02T17:42:46.467Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-06-02T17:42:46.467Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-cloudfoundry.xml
[2020-06-02T17:42:46.733Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-06-02T17:42:46.733Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-06-02T17:42:46.733Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-06-02T17:42:46.733Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-06-02T17:42:48.116Z] runbld>>> Test output logs contained: Errors: 0 Failures: 6 Tests: 9783 Skipped: 1315
[2020-06-02T17:42:48.375Z] runbld>>> Storing result
[2020-06-02T17:42:48.375Z] runbld>>> FAILURES: 6
[2020-06-02T17:42:49.756Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-06-02T17:42:49.756Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200602174241-D4C06DDC
[2020-06-02T17:42:55.226Z] Running on worker-395930 in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18738
[2020-06-02T17:42:55.333Z] [INFO] getVaultSecret: Getting secrets
[2020-06-02T17:42:55.383Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-06-02T17:42:57.497Z] + chmod 755 generate-build-data.sh
[2020-06-02T17:42:57.497Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3 ABORTED 7392394
[2020-06-02T17:42:57.497Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3/steps/?limit=10000 -o steps-info.json
[2020-06-02T17:42:58.988Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18738/runs/3/tests/?status=FAILED -o tests-errors.json

urso added 3 commits June 2, 2020 17:01
The fingerprint processor used to reuse state between calls, but not
being threadsafe means that the processor might get into an invalid
state if it is used by multiple go-routines by accident, creating
invalid, non-reproducible hash values. This change does not reuse the
hash state between runs.

Running the benchmarks seems to suggest that we don't create any extra
allocations with this change (tested with go1.13):

$ go test -bench . -benchmem
goos: darwin
goarch: amd64
pkg: github.com/elastic/beats/v7/libbeat/processors/fingerprint
BenchmarkHashMethods/sha384-4         	1000000000	         0.123 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha512-4         	1000000000	         0.125 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/xxhash-4         	1000000000	         0.0539 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/md5-4            	1000000000	         0.0925 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha1-4           	1000000000	         0.112 ns/op	       0 B/op	       0 allocs/op
BenchmarkHashMethods/sha256-4         	1000000000	         0.134 ns/op	       0 B/op	       0 allocs/op
@urso urso force-pushed the fingerprint-threadsafe branch from db11ece to aba010a Compare June 2, 2020 15:02
@urso
Copy link
Author

urso commented Jun 3, 2020

Test failures are unrelated.

@urso urso merged commit 6c4734b into elastic:master Jun 3, 2020
@urso urso deleted the fingerprint-threadsafe branch June 3, 2020 11:15
@urso urso added the v7.9.0 label Jun 3, 2020
urso pushed a commit to urso/beats that referenced this pull request Jun 3, 2020
@urso urso added needs_backport PR is waiting to be backported to other branches. v7.8.1 labels Jun 4, 2020
urso pushed a commit that referenced this pull request Jun 4, 2020
@urso urso removed the needs_backport PR is waiting to be backported to other branches. label Jul 3, 2020
urso pushed a commit to urso/beats that referenced this pull request Jul 3, 2020
urso pushed a commit that referenced this pull request Jul 6, 2020
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug libbeat review skip-test-plan Team:Services (Deprecated) Label for the former Integrations-Services team v7.8.1 v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants