-
Notifications
You must be signed in to change notification settings - Fork 938
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
[KYUUBI #2686] Fix lock bug if engine initialization timeout #2687
Conversation
kyuubi-server/src/test/scala/org/apache/kyuubi/engine/EngineRefSuite.scala
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #2687 +/- ##
============================================
- Coverage 64.32% 64.12% -0.20%
- Complexity 80 275 +195
============================================
Files 385 407 +22
Lines 18628 19105 +477
Branches 2523 2569 +46
============================================
+ Hits 11983 12252 +269
- Misses 5506 5703 +197
- Partials 1139 1150 +11
Continue to review full report at Codecov.
|
unbelievable my local works well with the test code... but the ga failed sometime |
Seems the test is stable, cc @yaooqinn @turboFei @pan3793 @cfmcgrady |
kyuubi-server/src/test/scala/org/apache/kyuubi/engine/EngineRefSuite.scala
Outdated
Show resolved
Hide resolved
what is the current behavior? |
if three(more than two) request coming, if the first request initializes engine timeout, we will get two engines from the last two request. |
if A hangs with a big timeout, considering B/C are sequentially retries of A, so they are going to make server fe threads be exhausted? |
hmm? so the timeout here means time to acquire the lock,not time to hold the lock? |
yeah.. that's right |
so,shall we throw exception if timeout? |
For now, the timeout of The current code path: tryWithLock(discoveryClient) {
val startTime ..
if (started + timeout <= System.currentTimeMillis()) {
throw ..
}
} The expected code path: val startTime ..
tryWithLockAndThrowWhenTimeout(startTime, discoveryClient) {
if (started + timeout <= System.currentTimeMillis()) {
throw ..
}
} |
// to avoid client too long to waiting in concurrent. | ||
|
||
// Return false means we are timeout | ||
val acquired = lock.acquire(timeout, unit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TimeUnit.MILLISECONDS directly, the timeout is always millis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the unit here? ETCD lease timeout is seconds, and cannot change unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply timeout / 1000 for etcd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK to
|
||
// we should only submit two engines, the last request should timeout and fail | ||
assert(MetricsSystem.counterValue(ENGINE_TOTAL).get - beforeEngines == 2) | ||
executor.shutdown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we put it in the finally block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, added it
thanks for review ! merging to master |
seems a lot of conflicts.. I will do backport manually |
backport #2687 for branch-1.5 ### _Why are the changes needed?_ closes #2686 ### _How was this patch tested?_ - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2705 from ulysses-you/KYUUBI-2686-1.5. Closes #2686 8db5ee3 [ulysses-you] fix a8b17db [ulysses-you] engine type f76bfb7 [ulysses-you] Fix lock bug if engine initialization timeout Authored-by: ulysses-you <ulyssesyou18@gmail.com> Signed-off-by: ulysses-you <ulyssesyou@apache.org>
backport apache#2687 for branch-1.5 ### _Why are the changes needed?_ closes apache#2686 ### _How was this patch tested?_ - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes apache#2705 from ulysses-you/KYUUBI-2686-1.5. Closes apache#2686 8db5ee3 [ulysses-you] fix a8b17db [ulysses-you] engine type f76bfb7 [ulysses-you] Fix lock bug if engine initialization timeout Authored-by: ulysses-you <ulyssesyou18@gmail.com> Signed-off-by: ulysses-you <ulyssesyou@apache.org>
Why are the changes needed?
closes #2686
How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate
Run test locally before make a pull request