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

Bugfix for java.lang.RuntimeException: Couldn’t get PID of Grakn. Received ' #2815

Merged
merged 2 commits into from
May 24, 2018

Conversation

lolski
Copy link
Member

@lolski lolski commented May 23, 2018

Why is this PR needed?

Addresses issue #2811

What does the PR do?

  1. Replace ps -ef | grep with ManagementFactory.getRuntimeMXBean().getName()
  2. If an Engine PID file is left but the process isn't running we know that it is a left-over PID file which can safely be overwritten.

Does it break backwards compatibility?

No

List of future improvements not on this PR

N/A

@lolski lolski added the stable label May 23, 2018
@lolski lolski changed the title Bugfix unable to retrieve pid Bugfix for java.lang.RuntimeException: Couldn’t get PID of Grakn. Received ' May 23, 2018
@marco-scoppetta
Copy link
Contributor

what could go wrong?


String pidString = outputS.toString().trim();
String[] pidAndHostnameString = ManagementFactory.getRuntimeMXBean().getName().split("@");
String pidString = pidAndHostnameString[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know how portability is affected? isn't the name platform-specific? That's what the RuntimeMXBean spec says.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasper-piskorski There exists no platform-independent way that can be guaranteed to work in all jvm implementations. ManagementFactory.getRuntimeMXBean().getName() looks like the best (closest) solution. It's short, and probably works in every implementation in wide use.

On linux+windows it returns a value like 12345@hostname (12345 being the process id).

@lolski lolski merged commit a0f3263 into typedb:stable May 24, 2018
marco-scoppetta pushed a commit that referenced this pull request May 25, 2018
* fix gc launcher link and add extra comment (#2794)

* Removes uses of "<role_name> sub role" in docs examples, moving to "as" syntax (#2785)

Explicitly defining role hierarchies is deprecated, in favour of using the "as" keyword in a "relates" statement within a relationship.

* Bugfix for java.lang.RuntimeException: Couldn’t get PID of Grakn. Received ' (#2815)

* get pid using mxbean

* Engine should still start if there is a dangling /tmp/grakn-engine.pid file but there's no process anymore.
@grabl grabl added the stable label Sep 24, 2018
@lolski lolski deleted the bugfix-unable-to-retrieve-pid branch October 4, 2018 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants