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

Kirk Lund reassigned GEODE-3278:
--------------------------------

    Assignee: Kirk Lund

> 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
>            Assignee: 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)

Reply via email to