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

Close rd pipe after sending the request #1033

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

matheussilvasantos
Copy link
Contributor

What does this pull request do?

It closes the read pipe after sending the HTTP request.

Why is it important?

Not closing the read pipe causes a growing number of open file descriptors.

Observations

I've updated the closed? method. This way, the current tests will cover the change.

Checklist

  • I have signed the Contributor License Agreement.
  • My code follows the style guidelines of this project (See .rubocop.yml)
  • I have rebased my changes on top of the latest master branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • I have updated CHANGELOG.asciidoc
  • I have updated supported-technologies.asciidoc
  • Added an API method or config option? Document in which version this will be introduced

Related issues

@apmmachine
Copy link
Contributor

apmmachine commented Jun 30, 2021

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Started by user Mikkel Malmberg

  • Start Time: 2021-07-05T18:51:47.487+0000

  • Duration: 26 min 36 sec

  • Commit: e7f5711

Test stats 🧪

Test Results
Failed 2
Passed 44460
Skipped 81
Total 44543

Trends 🧪

Image of Build Times

Image of Tests

Test errors 2

Expand to view the tests failures

Tests / Tests / Ruby:docker.elastic.co/observability-ci/jruby:9.2-11-jdk#rails-6.0 / ElasticAPM::Instrumenter#end_transaction reports metrics – #end_transaction
    Expand to view the error details

     failed ElasticAPM::Instrumenter#end_transaction reports metrics 
    

    Expand to view the stacktrace

     
            undefined method `samples' for nil:NilClass
    ["./spec/elastic_apm/instrumenter_spec.rb:186:in `block in ElasticAPM'", "/usr/local/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb:37:in `block in /usr/local/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb'"]
           
    

Tests / Tests / Ruby:docker.elastic.co/observability-ci/jruby:9.2-11-jdk#rails-6.0 / ElasticAPM::Instrumenter#end_transaction with breakdown metrics disabled skips breakdown but keeps transaction metrics – with breakdown metrics disabled
    Expand to view the error details

     failed ElasticAPM::Instrumenter#end_transaction with breakdown metrics disabled skips breakdown but keeps transaction metrics 
    

    Expand to view the stacktrace

     
            
    expected #<Integer:3> => 1
         got #<Integer:1> => 0
    
    Compared using equal?, which compares object identity,
    but expected and actual are not the same object. Use
    `expect(actual).to eq(expected)` if you don't care about
    object identity in this example.
    
    
    ["./spec/elastic_apm/instrumenter_spec.rb:212:in `block in ElasticAPM'", "/usr/local/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb:37:in `block in /usr/local/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb'"]
           
    

Steps errors 9

Expand to view the steps failures

Shell Script
  • Took 3 min 37 sec . View more details on here
  • Description: ./spec/scripts/spec.sh jruby:9.2 rails-6.1
Shell Script
  • Took 1 min 52 sec . View more details on here
  • Description: ./spec/scripts/spec.sh jruby:9.2 rails-6.1
Shell Script
  • Took 3 min 42 sec . View more details on here
  • Description: ./spec/scripts/spec.sh jruby:9.2 rails-6.0
Shell Script
  • Took 1 min 54 sec . View more details on here
  • Description: ./spec/scripts/spec.sh jruby:9.2 grape-1.5
Shell Script
  • Took 3 min 47 sec . View more details on here
  • Description: ./spec/scripts/spec.sh docker.elastic.co/observability-ci/jruby:9.2-11-jdk rails-6.0
Shell Script
  • Took 2 min 14 sec . View more details on here
  • Description: ./spec/scripts/spec.sh docker.elastic.co/observability-ci/jruby:9.2-11-jdk rails-6.0
Shell Script
  • Took 3 min 59 sec . View more details on here
  • Description: ./spec/scripts/spec.sh docker.elastic.co/observability-ci/jruby:9.2-8-jdk rails-6.1
Restore files previously stashed
  • Took 0 min 0 sec . View more details on here
  • Description: coverage-jruby-9.2-rails-6.1
Error signal
  • Took 0 min 0 sec . View more details on here
  • Description: Ruby:jruby:9.2#rails-6.1 tests failed : hudson.AbortException: script returned exit code 1

Log output

Expand to view the last 100 lines of log output

[2021-07-05T19:15:55.348Z] spec/integration/rails_metrics_stress_spec.rb
[2021-07-05T19:15:55.348Z] ========================================
[2021-07-05T19:16:05.340Z] Coverage may be inaccurate; set the "--debug" command line option, or do JRUBY_OPTS="--debug" or set the "debug.fullTrace=true" option in your .jrubyrc
[2021-07-05T19:16:05.340Z] /usr/local/bundle/jruby/2.5.0/gems/simplecov-0.21.2/lib/simplecov.rb:345: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:11.951Z] Randomized with seed 20262
[2021-07-05T19:16:11.951Z] *
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:11.951Z] Pending: (Failures listed here are expected and do not affect your suite's status)
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:11.951Z]   1) Rails integration handles multiple threads
[2021-07-05T19:16:11.951Z]      # Temporarily skipped with xdescribe
[2021-07-05T19:16:11.951Z]      # ./spec/integration/rails_metrics_stress_spec.rb:87
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:11.951Z] Finished in 0.04955 seconds (files took 7.36 seconds to load)
[2021-07-05T19:16:11.951Z] 1 example, 0 failures, 1 pending
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:11.951Z] Randomized with seed 20262
[2021-07-05T19:16:11.951Z] 
[2021-07-05T19:16:13.335Z] Coverage report generated for RSpec to /app/coverage/matrix_results/rails-6.1-docker.elastic.co/observability-ci/jruby-9.2-8-jdk. 0 / 3325 LOC (0.0%) covered.
[2021-07-05T19:16:13.335Z] ========================================
[2021-07-05T19:16:13.335Z] spec/integration/mongo_spec.rb
[2021-07-05T19:16:13.335Z] ========================================
[2021-07-05T19:16:23.380Z] Coverage may be inaccurate; set the "--debug" command line option, or do JRUBY_OPTS="--debug" or set the "debug.fullTrace=true" option in your .jrubyrc
[2021-07-05T19:16:23.380Z] /usr/local/bundle/jruby/2.5.0/gems/simplecov-0.21.2/lib/simplecov.rb:345: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
[2021-07-05T19:16:31.513Z] 
[2021-07-05T19:16:31.513Z] Randomized with seed 56523
[2021-07-05T19:16:32.294Z] .....
[2021-07-05T19:16:32.294Z] 
[2021-07-05T19:16:32.294Z] Finished in 1.83 seconds (files took 8.43 seconds to load)
[2021-07-05T19:16:32.294Z] 5 examples, 0 failures
[2021-07-05T19:16:32.294Z] 
[2021-07-05T19:16:32.294Z] Randomized with seed 56523
[2021-07-05T19:16:32.294Z] 
[2021-07-05T19:16:34.204Z] Coverage report generated for RSpec to /app/coverage/matrix_results/rails-6.1-docker.elastic.co/observability-ci/jruby-9.2-8-jdk. 0 / 3987 LOC (0.0%) covered.
[2021-07-05T19:16:34.204Z] ========================================
[2021-07-05T19:16:34.204Z] spec/integration/rails_console_spec.rb
[2021-07-05T19:16:34.204Z] ========================================
[2021-07-05T19:16:44.241Z] Coverage may be inaccurate; set the "--debug" command line option, or do JRUBY_OPTS="--debug" or set the "debug.fullTrace=true" option in your .jrubyrc
[2021-07-05T19:16:44.506Z] /usr/local/bundle/jruby/2.5.0/gems/simplecov-0.21.2/lib/simplecov.rb:345: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
[2021-07-05T19:16:51.183Z] 
[2021-07-05T19:16:51.183Z] Randomized with seed 59507
[2021-07-05T19:16:52.566Z] .
[2021-07-05T19:16:52.566Z] 
[2021-07-05T19:16:52.566Z] Finished in 1.68 seconds (files took 7.64 seconds to load)
[2021-07-05T19:16:52.566Z] 1 example, 0 failures
[2021-07-05T19:16:52.566Z] 
[2021-07-05T19:16:52.566Z] Randomized with seed 59507
[2021-07-05T19:16:52.566Z] 
[2021-07-05T19:16:54.478Z] Coverage report generated for RSpec to /app/coverage/matrix_results/rails-6.1-docker.elastic.co/observability-ci/jruby-9.2-8-jdk. 0 / 3325 LOC (0.0%) covered.
[2021-07-05T19:16:54.478Z] ========================================
[2021-07-05T19:16:54.478Z] spec/integration/rails_paths_spec.rb
[2021-07-05T19:16:54.478Z] ========================================
[2021-07-05T19:17:04.476Z] Coverage may be inaccurate; set the "--debug" command line option, or do JRUBY_OPTS="--debug" or set the "debug.fullTrace=true" option in your .jrubyrc
[2021-07-05T19:17:04.476Z] /usr/local/bundle/jruby/2.5.0/gems/simplecov-0.21.2/lib/simplecov.rb:345: warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
[2021-07-05T19:17:11.060Z] 
[2021-07-05T19:17:11.061Z] Randomized with seed 7893
[2021-07-05T19:17:13.601Z] .
[2021-07-05T19:17:13.601Z] 
[2021-07-05T19:17:13.601Z] Finished in 2.85 seconds (files took 7.41 seconds to load)
[2021-07-05T19:17:13.601Z] 1 example, 0 failures
[2021-07-05T19:17:13.601Z] 
[2021-07-05T19:17:13.601Z] Randomized with seed 7893
[2021-07-05T19:17:13.601Z] 
[2021-07-05T19:17:14.984Z] Coverage report generated for RSpec to /app/coverage/matrix_results/rails-6.1-docker.elastic.co/observability-ci/jruby-9.2-8-jdk. 0 / 3987 LOC (0.0%) covered.
[2021-07-05T19:17:15.984Z] Recording test results
[2021-07-05T19:17:19.615Z] [Checks API] No suitable checks publisher found.
[2021-07-05T19:17:19.626Z] Running in /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1033/src/github.com/elastic/apm-agent-ruby
[2021-07-05T19:17:19.645Z] Archiving artifacts
[2021-07-05T19:17:20.029Z] Stashed 33 file(s)
[2021-07-05T19:17:21.098Z] Post stage
[2021-07-05T19:17:21.363Z] Running in /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1033/src/github.com/elastic/apm-agent-ruby
[2021-07-05T19:17:22.633Z] Error when executing always post condition:
[2021-07-05T19:17:22.633Z] hudson.AbortException: No such saved stash ‘coverage-jruby-9.2-rails-6.1’
[2021-07-05T19:17:22.633Z] 	at org.jenkinsci.plugins.workflow.flow.StashManager.unstash(StashManager.java:159)
[2021-07-05T19:17:22.633Z] 	at org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:76)
[2021-07-05T19:17:22.633Z] 	at org.jenkinsci.plugins.workflow.support.steps.stash.UnstashStep$Execution.run(UnstashStep.java:63)
[2021-07-05T19:17:22.633Z] 	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2021-07-05T19:17:22.633Z] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2021-07-05T19:17:22.633Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2021-07-05T19:17:22.633Z] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2021-07-05T19:17:22.633Z] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2021-07-05T19:17:22.633Z] 	at java.lang.Thread.run(Thread.java:748)
[2021-07-05T19:17:22.633Z] 
[2021-07-05T19:17:22.676Z] Failed in branch Tests
[2021-07-05T19:17:22.725Z] Stage "Benchmarks" skipped due to earlier failure(s)
[2021-07-05T19:17:22.739Z] Stage "Benchmarks" skipped due to earlier failure(s)
[2021-07-05T19:17:22.768Z] Stage "Benchmarks" skipped due to earlier failure(s)
[2021-07-05T19:17:22.815Z] Stage "Release" skipped due to earlier failure(s)
[2021-07-05T19:17:22.829Z] Stage "Release" skipped due to earlier failure(s)
[2021-07-05T19:17:22.859Z] Stage "Release" skipped due to earlier failure(s)
[2021-07-05T19:17:22.888Z] Stage "Release" skipped due to earlier failure(s)
[2021-07-05T19:17:22.918Z] Stage "Release" skipped due to earlier failure(s)
[2021-07-05T19:17:23.164Z] Running on Jenkins in /var/lib/jenkins/workspace/_ruby_apm-agent-ruby-mbp_PR-1033
[2021-07-05T19:17:23.203Z] [INFO] getVaultSecret: Getting secrets
[2021-07-05T19:17:23.240Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2021-07-05T19:17:23.877Z] + chmod 755 generate-build-data.sh
[2021-07-05T19:17:23.877Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-ruby/apm-agent-ruby-mbp/PR-1033/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-ruby/apm-agent-ruby-mbp/PR-1033/runs/8 FAILURE 1536131
[2021-07-05T19:17:23.878Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-ruby/apm-agent-ruby-mbp/PR-1033/runs/8/steps/?limit=10000 -o steps-info.json
[2021-07-05T19:17:25.221Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-agent-ruby/apm-agent-ruby-mbp/PR-1033/runs/8/tests/?status=FAILED -o tests-errors.json

Copy link
Contributor

@mikker mikker left a comment

Choose a reason for hiding this comment

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

This looks good, thanks! I'll let the tests run.

lib/elastic_apm/transport/connection/http.rb Outdated Show resolved Hide resolved
@mikker
Copy link
Contributor

mikker commented Jun 30, 2021

jenkins, run the tests

@mikker
Copy link
Contributor

mikker commented Jul 1, 2021

Jenkins, run the tests

@mikker
Copy link
Contributor

mikker commented Jul 5, 2021

jenkins, run the tests

@mikker
Copy link
Contributor

mikker commented Jul 6, 2021

Spec failure is unrelated.

Thank you for this, @matheussilvasantos !

@mikker mikker merged commit 6a11c0f into elastic:master Jul 6, 2021
@matheussilvasantos matheussilvasantos deleted the close-rd-pipe branch July 6, 2021 12:29
@matheussilvasantos matheussilvasantos restored the close-rd-pipe branch July 6, 2021 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too many open file descriptors
3 participants