Skip to content
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

WriteBatcher intermittent hang in awaitCompletion() #837

Closed
srinathgit opened this issue Oct 6, 2017 · 5 comments
Closed

WriteBatcher intermittent hang in awaitCompletion() #837

srinathgit opened this issue Oct 6, 2017 · 5 comments

Comments

@srinathgit
Copy link
Contributor

srinathgit commented Oct 6, 2017

The following test intermittently hangs in awaitCompletion(). The thread dump is attached.
jstack.txt

@Test
	public void testStopOneNode() throws Exception {
		Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 0);
		final AtomicInteger successCount = new AtomicInteger(0);
		final AtomicBoolean failState = new AtomicBoolean(false);
		final AtomicInteger failCount = new AtomicInteger(0);
		try {
			WriteBatcher ihb2 = dmManager.newWriteBatcher();
			ihb2.withBatchSize(2);
			ihb2.withThreadCount(99);
			HostAvailabilityListener.getInstance(ihb2).withSuspendTimeForHostUnavailable(Duration.ofSeconds(40))
					.withMinHosts(2);
			NoResponseListener.getInstance(ihb2).withSuspendTimeForHostUnavailable(Duration.ofSeconds(40))
					.withMinHosts(2);
			ihb2.onBatchSuccess(batch -> {
				successCount.addAndGet(batch.getItems().length);
			}).onBatchFailure((batch, throwable) -> {
				throwable.printStackTrace();
				failState.set(true);
				failCount.addAndGet(batch.getItems().length);
			});

			writeTicket = dmManager.startJob(ihb2);
			AtomicBoolean isRunning = new AtomicBoolean(true);
			for (int j = 0; j < 50000; j++) {
				String uri = "/local/ABC-" + j;
				ihb2.add(uri, stringHandle);
				if (dmManager.getJobReport(writeTicket).getSuccessEventsCount() > 200 && isRunning.get()) {
					isRunning.set(false);
					serverStartStop(hostNames[hostNames.length - 1], "stop");
				}
			}
			ihb2.flushAndWait();

		} catch (Exception e) {
			e.printStackTrace();
		}
		Thread.currentThread().sleep(5000L);
		System.out.println("Fail : " + failCount.intValue());
		System.out.println("Success : " + successCount.intValue());
		System.out.println("Count : " + dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue());
		Assert.assertTrue(dbClient.newServerEval().xquery(query1).eval().next().getNumber().intValue() == 50000);
	}
@vivekmuniyandi
Copy link
Contributor

Moving to 4.0.4 as there is no data loss here and we are in controlled check in phase

@srinathgit
Copy link
Contributor Author

I am seeing this more frequently in my runs (about 2 times in the last 10 runs)

sammefford referenced this issue Oct 26, 2017
@jmakeig
Copy link
Contributor

jmakeig commented Nov 21, 2017

How is this different than #836?

@vivekmuniyandi
Copy link
Contributor

@jmakeig The point where the threads are waiting are different in #836 and here.

@vivekmuniyandi vivekmuniyandi removed their assignment Dec 20, 2017
@vivekmuniyandi
Copy link
Contributor

I am not able to replicate this issue anymore. Confirmed with @srinathgit that the nightly runs are also fine and they no longer see this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants