Skip to content

Commit

Permalink
[KYUUBI #5869] Add volatile to variables in KyuubiSessionImpl that ma…
Browse files Browse the repository at this point in the history
…y be operated by multiple threads

# 🔍 Description
## Issue References 🔗

minor fix

## Describe Your Solution 🔧

Add volatile to variables that may be operated by multiple threads.

## Types of changes 🔖

- [X] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklists
## 📝 Author Self Checklist

- [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project
- [x] I have performed a self-review
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] 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
- [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

## 📝 Committer Pre-Merge Checklist

- [x] Pull request title is okay.
- [x] No license issues.
- [x] Milestone correctly set?
- [ ] Test coverage is ok
- [ ] Assignees are selected.
- [ ] Minimum number of approvals
- [ ] No changes are requested

**Be nice. Be informative.**

Closes #5869 from wForget/hotfix.

Closes #5869

1169f13 [wforget] Add volatile to variables that may be operated by multiple threads

Authored-by: wforget <[email protected]>
Signed-off-by: wforget <[email protected]>
  • Loading branch information
wForget committed Dec 21, 2023
1 parent e2d9a8e commit 37620d4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ class KyuubiSessionImpl(
sessionManager.getConf)
}

private var _client: KyuubiSyncThriftClient = _
@volatile private var _client: KyuubiSyncThriftClient = _
def client: KyuubiSyncThriftClient = _client

private var _engineSessionHandle: SessionHandle = _
@volatile private var _engineSessionHandle: SessionHandle = _

private var openSessionError: Option[Throwable] = None
@volatile private var openSessionError: Option[Throwable] = None

override def open(): Unit = handleSessionException {
traceMetricsOnOpen()
Expand Down Expand Up @@ -290,7 +290,7 @@ class KyuubiSessionImpl(
private val engineAliveTimeout = sessionConf.get(KyuubiConf.ENGINE_ALIVE_TIMEOUT)
private val aliveProbeEnabled = sessionConf.get(KyuubiConf.ENGINE_ALIVE_PROBE_ENABLED)
private val engineAliveMaxFailCount = sessionConf.get(KyuubiConf.ENGINE_ALIVE_MAX_FAILURES)
private var engineAliveFailCount = 0
@volatile private var engineAliveFailCount = 0

def checkEngineConnectionAlive(): Boolean = {
try {
Expand Down

0 comments on commit 37620d4

Please sign in to comment.