You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Kirk Lund (JIRA)" <ji...@apache.org> on 2017/07/20 21:34:00 UTC
[jira] [Created] (GEODE-3278) Empty status file causes status
server and status locator to hang
Kirk Lund created GEODE-3278:
--------------------------------
Summary: Empty status file causes status server and status locator to hang
Key: GEODE-3278
URL: https://issues.apache.org/jira/browse/GEODE-3278
Project: Geode
Issue Type: Bug
Components: gfsh
Reporter: Kirk Lund
I added the following test to FileProcessControllerIntegrationTest to improve code coverage and hit this hang.
{noformat}
@Test
public void emptyStatusFileCausesStatusToHang() throws Exception {
// given: FileProcessController with pidFile containing real pid
new IntegerFileWriter(pidFile).writeToFile(pid);
FileProcessController controller = new FileProcessController(params, pid, 2, MINUTES);
// when: status is called in one thread
executor.execute(() -> {
try {
statusRef.set(controller.status());
} catch (Exception e) {
errorCollector.addError(e);
}
});
// and: json is written to the status file
new EmptyFileWriter(statusFile).createNewFile();
// then: returned status should be the json in the file
await().until(() -> assertThat(statusRef.get()).isEqualTo(STATUS_JSON));
}
{noformat}
FileProcessController wait forever to read from that status file:
{noformat}
ControlRequestHandler statusHandler = () -> {
// read the statusFile
StringBuilder lines = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader(statusFile))) {
String line;
while ((line = reader.readLine()) != null) {
lines.append(line);
}
} finally {
statusRef.set(lines.toString());
}
};
{noformat}
The above is blocking file reader which cannot be interrupted on Windows. If we change the code to be interrupted then we'll need to change to a non-blocking implementation so it can be interrupted on Windows.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)