This is an automated email from the ASF dual-hosted git repository.

feiwang pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new 82a7a4700 [KYUUBI #5869][1.8] Add volatile to variables in 
KyuubiSessionImpl that may be operated by multiple threads
82a7a4700 is described below

commit 82a7a47004f2f8ebbc27fe6b8548364fb64e9a2c
Author: wforget <[email protected]>
AuthorDate: Thu Dec 21 14:13:17 2023 -0800

    [KYUUBI #5869][1.8] Add volatile to variables in KyuubiSessionImpl that may 
be operated by multiple threads
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    minor fix
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Add volatile to variables that may be operated by multiple threads.
    
    ## Types of changes :bookmark:
    
    - [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 :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### 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
    
    1169f13f5 [wforget] Add volatile to variables that may be operated by 
multiple threads
    
    Authored-by: wforget <643348094qq.com>
    Signed-off-by: wforget <643348094qq.com>
    
    (cherry picked from commit 37620d40b6a98dec6889d1ffb81e57b4966c4447)
    
    Closes #5887 from wForget/dev-1.8.
    
    Closes #5869
    
    490f17ac7 [wforget] [KYUUBI #5869] Add volatile to variables in 
KyuubiSessionImpl that may be operated by multiple threads
    
    Authored-by: wforget <[email protected]>
    Signed-off-by: Fei Wang <[email protected]>
---
 .../main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
index 6dd1810a8..a5abb61fe 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
@@ -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()
@@ -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 {

Reply via email to