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

Drop Testing for Segfault Couchbase Versions #2252

Closed
wants to merge 47 commits into from

Conversation

sabrenner
Copy link
Collaborator

@sabrenner sabrenner commented Aug 3, 2022

What does this PR do?

Removes testing on couchbase versions 3.2.0 - 3.2.1 and 4.1.x, following intermittent segfaults in our CI.

Motivation

It would be nice to see clean CI runs, and the issues present here are most likely related to the way this plugin is being tested now on multiple versions, and not that the plugin itself is broken on our end (as it still passes locally and in most of CI cases). This is only a temporary change, pending more investigation into where the segfaults are coming from.

All of these commits/attempts resulted in the following conclusions/reasons for the segfaults (Note: these versions are still supported in instrumentation, they are just skipped in our tests):

3.2.0 - 3.2.1: Intermittent segfaults present, fixed in 3.2.2 (https://forums.couchbase.com/t/segfault-in-connection-desctructor-using-3-2-1/31632) (https://issues.couchbase.com/browse/JSCBC-916)
** 4.1.x**: This might require a bit more exploration on our end, but our testing framework + couchbase doesn't play well when testing successive versions post-4.0, as a multiple logger exception is thrown from the underlying native add-on. This can maybe be resolved in our testing framework, but for now is just ignored.

@sabrenner sabrenner requested a review from a team as a code owner August 3, 2022 13:19
@codecov
Copy link

codecov bot commented Aug 3, 2022

Codecov Report

Merging #2252 (4713828) into master (6eeb958) will increase coverage by 0.55%.
The diff coverage is 82.85%.

❗ Current head 4713828 differs from pull request most recent head 9a4c59c. Consider uploading reports for the commit 9a4c59c to get more accurate results

@@            Coverage Diff             @@
##           master    #2252      +/-   ##
==========================================
+ Coverage   92.94%   93.49%   +0.55%     
==========================================
  Files         220      218       -2     
  Lines        8515     8966     +451     
==========================================
+ Hits         7914     8383     +469     
+ Misses        601      583      -18     
Impacted Files Coverage Δ
packages/datadog-instrumentations/src/couchbase.js 91.26% <82.85%> (ø)
packages/dd-trace/src/scope.js 83.33% <0.00%> (-12.67%) ⬇️
packages/datadog-instrumentations/src/restify.js 94.11% <0.00%> (-5.89%) ⬇️
packages/dd-trace/src/noop/scope.js 16.66% <0.00%> (-3.34%) ⬇️
packages/datadog-plugin-http/src/server.js 89.65% <0.00%> (-2.02%) ⬇️
packages/dd-trace/src/startup-log.js 95.38% <0.00%> (-1.23%) ⬇️
packages/datadog-instrumentations/src/fastify.js 98.38% <0.00%> (-0.35%) ⬇️
packages/dd-trace/src/id.js 97.10% <0.00%> (-0.09%) ⬇️
packages/dd-trace/src/config.js 98.92% <0.00%> (-0.03%) ⬇️
packages/dd-trace/src/plugins/index.js 100.00% <0.00%> (ø)
... and 40 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Aug 5, 2022

Overall package size

Self size: 2.58 MB
Deduped: 29.73 MB
No deduping: 30.35 MB

Dependency sizes

name version self size total size
@datadog/pprof 1.0.2 8.74 MB 14.46 MB
@datadog/native-metrics 1.4.2 6.61 MB 7.04 MB
@datadog/native-appsec 1.2.1 5.1 MB 5.43 MB
opentracing 0.14.7 194.81 kB 194.81 kB
@datadog/sketches-js 2.0.0 105.44 kB 105.44 kB
lodash.sortby 4.7.0 75.76 kB 75.76 kB
semver 5.7.1 61.58 kB 61.58 kB
ignore 5.2.0 48.87 kB 48.87 kB
import-in-the-middle 1.3.0 30.3 kB 34.77 kB
retry 0.10.1 27.44 kB 27.44 kB
lodash.uniq 4.5.0 25.01 kB 25.01 kB
limiter 1.1.5 23.17 kB 23.17 kB
lodash.kebabcase 4.1.1 17.75 kB 17.75 kB
lodash.pick 4.4.0 16.33 kB 16.33 kB
crypto-randomuuid 1.0.0 11.18 kB 11.18 kB
diagnostics_channel 1.1.0 7.07 kB 7.07 kB
path-to-regexp 0.1.7 6.78 kB 6.78 kB
koalas 1.0.2 6.47 kB 6.47 kB
methods 1.1.2 5.29 kB 5.29 kB
module-details-from-path 1.0.3 4.47 kB 4.47 kB

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@sabrenner sabrenner marked this pull request as ready for review August 9, 2022 13:12
@@ -1,7 +1,7 @@
version: "2"
services:
couchbase:
image: sabrenner/couchbase-server-sandbox:latest
image: sabrenner/couchbase-server-sandbox:sandbox
Copy link
Member

Choose a reason for hiding this comment

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

What's the sandbox tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just a different version of the image I pushed up. It uses a different parent image, but I wanted to keep the other one in the case that it could still be useful, so I just named this one something different.

const startCh = channel('apm:couchbase:query:start')
const finishCh = channel('apm:couchbase:query:finish')
const errorCh = channel('apm:couchbase:query:error')
if (!semver.satisfies(process.version, '>=14.0.0')) {
Copy link
Member

Choose a reason for hiding this comment

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

Can this be done in the test instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added this here because, when running tests in the couchbase job (v3 and higher), using Node 14, it would still try and build v2 using that Node version as well, which would cause a crash (and, trying to run v3 and higher tests with Node 12, which is what works with couchbase v2, would also cause it to crash). So, I put this here to not even build couchbase v2 when using Node 14 and higher. If there is a way I can add this to the tests instead, I will!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems to me like it'd be valuable to just add a nodeVersions option to the addHook(options, ...) input so checks like this could be done anywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is something I'd be happy to add in a separate PR. It would definitely help in this case too in cleaning up the tests.

Copy link
Member

Choose a reason for hiding this comment

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

I added this here because, when running tests in the couchbase job (v3 and higher), using Node 14, it would still try and build v2 using that Node version as well

This is basically my point, if this code is only for tests it should be in tests. If someone gets couchbase to build on Node 14 for example, there is no reason why our instrumentation shouldn't work. An option could be added to externals.json for example.

addHook({
name: 'couchbase',
file: 'dist/collection.js',
versions: ['3.2.0 - 3.2.1', '3.2.2 - 3.2.4', '4.0.0', '^4.1.0'] }, collection => {
Copy link
Member

Choose a reason for hiding this comment

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

Additional ranges can be added to externals.json instead.

Copy link
Member

Choose a reason for hiding this comment

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

Especially since this range won't support new versions automatically.

cluster.authenticate('Administrator', 'password')
cluster.enableCbas('localhost:8095')
bucket = cluster.openBucket('datadog-test', (err) => done(err))
if (VERSION === 'v2') {
Copy link
Member

Choose a reason for hiding this comment

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

Why is a completely different test suite needed for v2 and v3? Could most of the code be reused and just have a different setup function for example?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm maybe, but there are just enough small differences in some tests, and some checks, that I decided to have them separate. I might just be able to remove the envvar check, but that would rely on keeping the change two comments above (restricting node versions, which for now is in the integration, but again, if there's a way I can move that to the tests, I definitely will!).

} else {
const ignoreVersions = version =>
semver.intersects(version, '3.2.0 - 3.2.1') || // related to JSCBC-916
semver.intersects(version, '^4.1.0') // multiple spdlog error
Copy link
Member

Choose a reason for hiding this comment

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

Could we ignore 4.0.0 instead of ignoring the latest version? Otherwise we won't know if something breaks with a new release of the library.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I'll give that a shot, but I would probably have to take more of a look into why there is some multiple loggers exception. This happens when testing any multiple versions of 4.x together (so, if I tested ^4.1.0, it would test 4.1.0 and whatever latest 4.x version there is, triggering the exception. I used 4.0.0 as a single version to avoid this, but also had the same thought you brought up before pushing this change up but thought I'd see what you'd say, so I'll look into it!).

@tlhunter tlhunter requested a review from a team as a code owner August 15, 2023 22:07
@tlhunter tlhunter requested review from jbertran and removed request for a team August 15, 2023 22:07
Copy link
Contributor

@jbertran jbertran left a comment

Choose a reason for hiding this comment

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

As far as I can tell this was addressed by #3265 - the test remains very occasionally flaky, but that seems to be down to the server image.

@sabrenner can we close this?

@sabrenner sabrenner closed this Aug 16, 2023
@sabrenner sabrenner deleted the sabrenner/couchbasesegfaultfix branch December 21, 2023 17:18
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.

None yet

4 participants