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

Embedded REST service should log why it fails to start (v4) #761

Closed
dlukes opened this issue Apr 30, 2022 · 1 comment · Fixed by #772
Closed

Embedded REST service should log why it fails to start (v4) #761

dlukes opened this issue Apr 30, 2022 · 1 comment · Fixed by #772

Comments

@dlukes
Copy link

dlukes commented Apr 30, 2022

When using the embedded REST service, I can see its own log messages interweaved in ANNIS's main log, viewed via journalctl. However, when the REST service crashes for some reason, the error which says what went wrong is not shown, e.g. this:

Error: Custom { kind: Other, error: "Could not initialize graphANNIS service: could not lock corpus directory data/\n\nCaused by:\n    Permission denied (os error 13)" }

I assume this is because this doesn't go through the logging interface, it just gets printed to STDERR?

This makes it quite hard to debug REST service startup issues. It's one of the reasons I ended up setting up a separate systemd service for the REST service, because these errors do show up there. Whereas with the embedded REST service, I guess they're swallowed up by the parent Java process.

@thomaskrause
Copy link
Member

This is strange, the current code should in theory output the data in the same manner as the other log messages, using the configured Logger

tReaderErr = new Thread(() -> {
              while (!this.abortThread.get() && backgroundProcess.isAlive()) {
                String line;
                try {
                  line = errorStream.readLine();
                  if (line != null) {
                    log.error(line);
                  }
                } catch (IOException ex) {
                  if (!this.abortThread.get()) {
                    log.error("Could not read service error output", ex);
                  }
                  break;
                }
                Thread.yield();
              }
            });

I investigate if I can reproduce this and why it fails to properly show in the journalctl output.

thomaskrause added a commit that referenced this issue May 31, 2022
This could happen e.g. because graphANNIS refuses to start.
This fixes #761
bors bot added a commit that referenced this issue May 31, 2022
772: Do not skip error messages when started service is aborted. r=thomaskrause a=thomaskrause

This could happen e.g. because graphANNIS refuses to start.
This fixes #761

Co-authored-by: Thomas Krause <thomas.krause@hu-berlin.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants