Skip to content

Test hang when set withThreadCount(1) and too many thread created in QueryBatcher #1279

Closed
@llinggit

Description

@llinggit

This is a corner case for task JAVA-195 and issue #1269.

For example in test StringQueryHostBatcherTest.testProgressListener, copied below, set "withThreadCount(1)" will cause a hang.

		  QueryBatcher batcher60 = dmManager.newQueryBatcher(querydef).withBatchSize(60);
                  .withThreadCount(1); //total of 6k docs
		  batcher60.onUrisReady(
				  new ProgressListener()
				  .onProgressUpdate(progressUpdate -> {
					  System.out.println("From ProgressListener (From Batch 60): " + progressUpdate.getProgressAsString());
                      int index = progressUpdate.getProgressAsString().indexOf(";");
                      progressSet60.add(progressUpdate.getProgressAsString().substring(0, index));
				  }));
		  batcher60.onQueryFailure((throwable) -> {
			  System.out.println("queryFailures 60: ");
			  try {
				  Thread.sleep(7000L);
			  } catch (Exception e) {
				  e.printStackTrace();
			  }
		  });

		  dmManager.startJob(batcher60);
		  batcher60.awaitCompletion();```

Other affected tests are 
TestSplitters.testWriteOpsMultipleThreads
DeleteListenerTest.massDeleteSingleThread
WriteandReadPOJOs.

So we can address your issue, please include the following:
### Version of MarkLogic Java Client API
See Readme.txt

### Version of MarkLogic Server

See admin gui on port 8001 or run xdmp:version() in Query Console - port 8000)

### Java version

Run `java -version`

### OS and version

For MAC, run `sw_vers`. \
For Windows, run  `systeminfo | findstr /B /C:"OS Name" /C:"OS Version"`\
For Linux, run `cat /etc/os-release` and `uname -r`

### Input: Some code to illustrate the problem, preferably in a state that can be independently reproduced on our end

### Actual output: What did you observe? What errors did you see? Can you attach the logs? (Java logs, MarkLogic logs)

### Expected output: What specifically did you expect to happen?

### Alternatives: What else have you tried, actual/expected?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions