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

goroutine leak detected in the driver package: callConverter #130

Closed
crobert-1 opened this issue Jan 12, 2024 · 1 comment
Closed

goroutine leak detected in the driver package: callConverter #130

crobert-1 opened this issue Jan 12, 2024 · 1 comment
Labels

Comments

@crobert-1
Copy link

Context
Hello, I'm currently working on open-telemetry/opentelemetry-collector-contrib#30438 to enable goleak to check for leaked goroutines.

Bug
Here's the stack trace for the leaked goroutine:

[Goroutine 9 in state select, with database/sql.(*DB).connectionOpener on top of the stack:
database/sql.(*DB).connectionOpener(0xc002123d40, {0x10895f940, 0xc002209770})
        /usr/local/Cellar/go/1.21.0/libexec/src/database/sql/sql.go:1218 +0x87
created by database/sql.OpenDB in goroutine 1
        /usr/local/Cellar/go/1.21.0/libexec/src/database/sql/sql.go:791 +0x165

I used a debugger to find the source of the leaking goroutine which is the following line:

var callConverter = sql.OpenDB(new(callConnector))

This line is executed when any package simply imports "github.com/SAP/go-hdb/driver". sql.OpenDB starts a goroutine to open the connection. There's currently no way to properly close the SQL DB connection as callConverter is a private variable.

Suggested solution
The best solution here would be a lazy instantiation, to only open the SQL DB connection when required. Also, the package should handle closing the connection on Close.

@crobert-1 crobert-1 changed the title goroutine leak detected in the driver package goroutine leak detected in the driver package: callConverter Jan 12, 2024
@stfnmllr stfnmllr added the bug label Jan 17, 2024
@stfnmllr
Copy link
Contributor

mx-psi referenced this issue in open-telemetry/opentelemetry-collector-contrib Jan 23, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/SAP/go-hdb](https://togithub.com/SAP/go-hdb) | `v1.7.4` ->
`v1.7.6` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fSAP%2fgo-hdb/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fSAP%2fgo-hdb/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fSAP%2fgo-hdb/v1.7.4/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fSAP%2fgo-hdb/v1.7.4/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>SAP/go-hdb (github.com/SAP/go-hdb)</summary>

###
[`v1.7.6`](https://togithub.com/SAP/go-hdb/blob/HEAD/RELEASENOTES.md#v176)

[Compare
Source](https://togithub.com/SAP/go-hdb/compare/v1.7.5...v1.7.6)

-   updated dependencies
-   bulkbench refresh

###
[`v1.7.5`](https://togithub.com/SAP/go-hdb/blob/HEAD/RELEASENOTES.md#v175)

[Compare
Source](https://togithub.com/SAP/go-hdb/compare/v1.7.4...v1.7.5)

-   updated dependencies
-   fixed issue starting go routines during driver initialization
-
[https://github.com/SAP/go-hdb/issues/130](https://togithub.com/SAP/go-hdb/issues/130)
-
[https://github.com/SAP/go-hdb/issues/131](https://togithub.com/SAP/go-hdb/issues/131)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
cparkins referenced this issue in AmadeusITGroup/opentelemetry-collector-contrib Feb 1, 2024
…try#30712)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/SAP/go-hdb](https://togithub.com/SAP/go-hdb) | `v1.7.4` ->
`v1.7.6` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fSAP%2fgo-hdb/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fSAP%2fgo-hdb/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fSAP%2fgo-hdb/v1.7.4/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fSAP%2fgo-hdb/v1.7.4/v1.7.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>SAP/go-hdb (github.com/SAP/go-hdb)</summary>

###
[`v1.7.6`](https://togithub.com/SAP/go-hdb/blob/HEAD/RELEASENOTES.md#v176)

[Compare
Source](https://togithub.com/SAP/go-hdb/compare/v1.7.5...v1.7.6)

-   updated dependencies
-   bulkbench refresh

###
[`v1.7.5`](https://togithub.com/SAP/go-hdb/blob/HEAD/RELEASENOTES.md#v175)

[Compare
Source](https://togithub.com/SAP/go-hdb/compare/v1.7.4...v1.7.5)

-   updated dependencies
-   fixed issue starting go routines during driver initialization
-
[https://github.com/SAP/go-hdb/issues/130](https://togithub.com/SAP/go-hdb/issues/130)
-
[https://github.com/SAP/go-hdb/issues/131](https://togithub.com/SAP/go-hdb/issues/131)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants