You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Barbara Pruijn (JIRA)" <ji...@apache.org> on 2018/02/28 16:16:00 UTC

[jira] [Resolved] (GEODE-3278) Empty status file causes status server and status locator to hang

     [ https://issues.apache.org/jira/browse/GEODE-3278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Barbara Pruijn resolved GEODE-3278.
-----------------------------------
    Resolution: Won't Do

> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)