Comments (4)
yes, with this change org.apache.bookkeeper.auth.TestAuth$LogCloseCallsBookieAuthProviderFactory.close is called twice.
With or without this change BookieServer.shutdown will be called twice because of the following callstacks:
org.apache.bookkeeper.proto.BookieServer.shutdown(BookieServer.java:165)
org.apache.bookkeeper.test.BookKeeperClusterTestCase.restartBookies(BookKeeperClusterTestCase.java:424)
org.apache.bookkeeper.test.BookKeeperClusterTestCase.restartBookies(BookKeeperClusterTestCase.java:373)
org.apache.bookkeeper.auth.TestAuth.entryCount(TestAuth.java:91)
org.apache.bookkeeper.auth.TestAuth.testCloseMethodCalledOnAuthProvider(TestAuth.java:148)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
and
org.apache.bookkeeper.proto.BookieServer.shutdown(BookieServer.java:165)
org.apache.bookkeeper.proto.BookieServer$DeathWatcher.run(BookieServer.java:229)
now because of this change, for the second BookieServer.shutdown call, though 'running' value in BookieServer.shutdown method is false, it will call BookieNettyServer.shutdown, which will in turn call TestAuth$LogCloseCallsBookieAuthProviderFactory.close for the second time. But before this change if 'running' value is false in BookieServer.shutdown method, then it wont call BookieNettyServer.shutdown.
As i mentioned earlier relying on 'running' is not reliable way of handling shutdown logic, especially in the case of partial successful start or partial successful shutdown. Also, all the shutdown/close methods should be idempotent operations. for eg: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html#shutdown() https://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html#close() .Similarly here calling BookieNettyServer.shutdown on second BookieServer.shutdown should be ok and it should be idempotent operation.
So fix for this testcase should be to change the expected value to '2' instead of '1' for this failure.
from bookkeeper.
@reddycharan I don't think the right approach is to change to the tests. we should just make the shutdown call idempotent.
from bookkeeper.
@reddycharan @sijie the close method of the factory is expected to be called once.
I am OK with the fact that close methods should be idempotent too but if it is possible it is better to make the call to "close" once. It is cleaner and for the long term it is the best approch
from bookkeeper.
sorry I typed the wrong issue id at #437. revert the labels and milestone.
from bookkeeper.
Related Issues (20)
- Startup issue HOT 1
- Task: upgrade RocksDB HOT 4
- Flaky-test: BookieAutoRecoveryTest.testEmptyLedgerLosesQuorumEventually flakes on CI (fail, then passes on rerun)
- Flaky-test: BookieAutoRecoveryTest.testClosedLedgers times out (but may succeed on re-run)
- Flaky-test: org.apache.bookkeeper.client.SlowBookieTest
- /api/v1/bookie/entry_location_compact NPE HOT 4
- 4.17.0 tag is missing for apache/bookkeeper image on Docker Hub HOT 7
- Dead lock error. HOT 6
- ensemble change may cause pendingAddOps of ledgerHandle to be unable to be resent, and the pulsar partition may become unavailable. HOT 1
- Permission denied in the docker image
- The maxPendingAddRequestsPerThread configuration is inconsistent with the actual behavior, resulting in netty direct memory OOM HOT 3
- Async log appender not print log when bookie starting error
- Optimal configuration for the cloud (with SSDs)
- Upgrade RocksDB default format_version to 5
- The Impact of compact entrylog on reading operation
- Decommission command throws KeeperErrorCode exception when autoRecovery is disabled
- [Test] Clean up Junit4 annotations after migrating to JUnit5
- BP-68: Delete cookie as part of decommission API.
- [Bug] EnforceMinNumRacksPerWriteQuorum is not working correctly in the isEnsembleAdheringToPlacementPolicy method of RackawareEnsemblePlacementPolicyImpl
- BufferedChannel's read(ByteBuf, long, int) gets stuck in loop HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bookkeeper.