-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-20973 Unusable thin client timeout #12569
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
Open
VolkodamovDaniil
wants to merge
6
commits into
apache:master
Choose a base branch
from
VolkodamovDaniil:ignite-20973
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a051e32
restore deprecated methods
VolkodamovDaniil e4cd7a0
renaming
VolkodamovDaniil 12dfe5d
add conn and req timeout tests
VolkodamovDaniil 5ce6f48
fix unstable timeout tests
VolkodamovDaniil 87e229e
remove redundant Thread.sleep
VolkodamovDaniil 56cf1e3
remove latch from connection timeout test
VolkodamovDaniil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |
| import org.apache.ignite.configuration.ClientConfiguration; | ||
| import org.apache.ignite.configuration.ClientConnectorConfiguration; | ||
| import org.apache.ignite.configuration.IgniteConfiguration; | ||
| import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException; | ||
| import org.apache.ignite.internal.IgniteInternalFuture; | ||
| import org.apache.ignite.internal.binary.streams.BinaryOutputStream; | ||
| import org.apache.ignite.internal.binary.streams.BinaryStreams; | ||
|
|
@@ -67,7 +68,7 @@ public class TimeoutTest extends AbstractThinClientTest { | |
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected ClientConfiguration getClientConfiguration() { | ||
| return super.getClientConfiguration().setTimeout(TIMEOUT); | ||
| return super.getClientConfiguration().setConnectionTimeout(TIMEOUT).setRequestTimeout(TIMEOUT); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -217,4 +218,104 @@ public void testClientTimeoutOnOperation() throws Exception { | |
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test that connection timeout is independent of request timeout during connection establishment. | ||
| */ | ||
| @Test | ||
| @SuppressWarnings("ThrowableNotThrown") | ||
| public void testConnectionTimeoutIndependentOfRequest() throws Exception { | ||
| ServerSocket sock = new ServerSocket(); | ||
| sock.bind(new InetSocketAddress("127.0.0.1", DFLT_PORT)); | ||
|
|
||
| IgniteInternalFuture<?> fut = GridTestUtils.runAsync(() -> { | ||
| Socket accepted = null; | ||
|
|
||
| try { | ||
| accepted = sock.accept(); | ||
|
|
||
| while (!Thread.currentThread().isInterrupted()) | ||
| Thread.sleep(10); | ||
| } | ||
| finally { | ||
| if (accepted == null) | ||
| U.closeQuiet(accepted); | ||
| } | ||
| }); | ||
|
|
||
| try { | ||
| ClientConfiguration cfg = new ClientConfiguration() | ||
| .setAddresses("127.0.0.1:" + DFLT_PORT) | ||
| .setConnectionTimeout(500) | ||
| .setRequestTimeout(Integer.MAX_VALUE); | ||
|
|
||
| GridTestUtils.assertThrowsWithCause( | ||
timoninmaxim marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| () -> Ignition.startClient(cfg), | ||
| IgniteFutureTimeoutCheckedException.class | ||
| ); | ||
|
|
||
| fut.cancel(); | ||
| } | ||
| finally { | ||
| U.closeQuiet(sock); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test that request timeout is independent of connection timeout during operations. | ||
| */ | ||
| @Test | ||
| @SuppressWarnings("ThrowableNotThrown") | ||
| public void testRequestTimeoutIndependentOfConnection() throws Exception { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar for this test:
|
||
| IgniteConfiguration igniteCfg = getConfiguration(getTestIgniteInstanceName()); | ||
| igniteCfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setHandshakeTimeout(Integer.MAX_VALUE)); | ||
|
|
||
| try (Ignite ignite = startGrid(igniteCfg)) { | ||
| ClientConfiguration cfg = getClientConfiguration(ignite) | ||
| .setConnectionTimeout(Integer.MAX_VALUE) | ||
| .setRequestTimeout(500); | ||
|
|
||
| try (IgniteClient client = Ignition.startClient(cfg)) { | ||
| ClientCache<Object, Object> cache = client.getOrCreateCache("testTimeoutCache"); | ||
|
|
||
| ClientCacheConfiguration txCacheCfg = new ClientCacheConfiguration() | ||
| .setName("txCache") | ||
| .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); | ||
|
|
||
| ClientCache<Object, Object> txCache = client.getOrCreateCache(txCacheCfg); | ||
|
|
||
| CyclicBarrier barrier = new CyclicBarrier(2); | ||
|
|
||
| IgniteInternalFuture<?> blockingThread = GridTestUtils.runAsync(() -> { | ||
| try (ClientTransaction ignored1 = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { | ||
| txCache.put(1, "blocked"); | ||
|
|
||
| barrier.await(2, TimeUnit.SECONDS); | ||
|
|
||
| // Wait for main thread to time out | ||
| barrier.await(2, TimeUnit.SECONDS); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For which reason you awaits main thread after sleeping? |
||
| } | ||
| catch (Exception e) { | ||
| throw new IgniteException(e); | ||
| } | ||
| }); | ||
|
|
||
| barrier.await(2, TimeUnit.SECONDS); | ||
|
|
||
| try (ClientTransaction ignored1 = client.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { | ||
| GridTestUtils.assertThrowsWithCause( | ||
| () -> txCache.put(1, "should timeout"), | ||
| IgniteFutureTimeoutCheckedException.class | ||
| ); | ||
| } | ||
|
|
||
| barrier.await(2, TimeUnit.SECONDS); | ||
|
|
||
| cache.put(1, "still works"); | ||
| assertEquals("still works", cache.get(1)); | ||
|
|
||
| blockingThread.get(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Please check that actual javadocs contains lines started with 'serial'. For which purpose this tag is used?