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

Implement daemon mode to interop with paperd #2836

Closed
wants to merge 1 commit into from
Closed

Conversation

DenWav
Copy link
Member

@DenWav DenWav commented Jan 11, 2020

Re-opened from #2319 to target master.

This commit adds the necessary logic so Paper can communicate with paperd.

paperd's 1.1.0 release marks the first release and compatible version with this PR.

Documentation on usage can be found here.

Documentation on the internals of the communication system can be found here.


Build Changes

This change also requires updates to paperclip-maven-plugin which were done here.

And the change to Paperclip to incorporate that Maven plugin update is here.

Both paperclip-maven-plugin and Paperclip itself were moved to the io.papermc package as well as a normal SNAPSHOT version bump.


Necessary steps before merging:


Currently on hold as there's a major bug in paperd that I need to fix first: PaperMC/paperd#9.

@DenWav DenWav changed the title WIP Implement daemon mode to interop with paperd Implement daemon mode to interop with paperd Jan 11, 2020
@kaplan-michael
Copy link

Hello, do you have any update on third party testing? could i help somehow?

Thanks Michael

@DenWav DenWav force-pushed the feature/daemon branch 3 times, most recently from 96533e0 to 0d83016 Compare April 12, 2020 08:58
@DenWav DenWav marked this pull request as ready for review April 12, 2020 21:43
@DenWav
Copy link
Member Author

DenWav commented Apr 12, 2020

@aikar @zachbr @electronicboy if y'all could take a gander I'd appreciate it - it's somewhat of a large change but 99% of it is all new code.

@electronicboy electronicboy self-requested a review April 12, 2020 21:49
@DenWav DenWav changed the title Implement daemon mode to interop with paperd WIP: Implement daemon mode to interop with paperd Apr 14, 2020
@DenWav DenWav force-pushed the feature/daemon branch 4 times, most recently from 2c787a8 to bb6d65d Compare June 26, 2020 03:37
@DenWav DenWav requested a review from a team as a code owner August 23, 2020 04:06
@DenWav DenWav changed the title WIP: Implement daemon mode to interop with paperd Implement daemon mode to interop with paperd Aug 23, 2020
Copy link
Contributor

@Proximyst Proximyst left a comment

Choose a reason for hiding this comment

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

This looks pretty damn good. Thank you for this new feature!

+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>2.12.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have log4j-core for 2.8.1 defined; do we need 2.12 here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no clue why that's there honestly. I'll need to look again.

+ /**
+ * This is the Unix socket file that {@code paperd} will use to communicate with this server.
+ */
+ private static final String SOCK_FILE = "paper.sock";
Copy link
Contributor

Choose a reason for hiding this comment

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

Customisable perhaps? Most software which operates using sockets allows at least for some env-var to set the socket path.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good thought, easy to add in too.

+ */
+ private static int sock;
+ /**
+ * IF we are in {@link #IS_DAEMON daemon mode} this will be set to the {@link Path} created from {@link #SOCK_FILE}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ * IF we are in {@link #IS_DAEMON daemon mode} this will be set to the {@link Path} created from {@link #SOCK_FILE}
+ * If we are in {@link #IS_DAEMON daemon mode} this will be set to the {@link Path} created from {@link #SOCK_FILE}

+
+ /* package */ MemoryStatus(final long freeMemory, final long totalMemory, final long maxMemory) {
+ final long usedMemory = totalMemory - freeMemory;
+ this.usedMemory = (usedMemory / 1_000_000) + " MB";
Copy link
Contributor

Choose a reason for hiding this comment

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

These strings should probably be left to paperd.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

{
}

+ /* Paper daemon - this is misleading, calling MinecraftServer.close above will already call System.exit
Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, this seems like it's unnecessary diff.

This should probably also be reported to Spigot's JIRA.

new file mode 100644
index 0000000000000000000000000000000000000000..4cf198fccb1aab43930745288717fa9ad308a39b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/daemon/CloseableQueue.java
Copy link
Contributor

Choose a reason for hiding this comment

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

Although not really a big deal for internal classes, perhaps we should use io.papermc.paper here? The JNI part makes this change harder for us to do, as not everyone might update their paperd while updating Paper, which would break it as a package changes in the future while paperd doesn't accomodate it. paperd isn't even released yet, so it shouldn't really pose any issue to be future proof.

@Proximyst Proximyst added status: rebase required type: feature Request for a new Feature. labels Aug 24, 2020
@stale
Copy link

stale bot commented Dec 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Proximyst
Copy link
Contributor

Stale who? Stale you! Wonder if we can make the bot ignore some issues...

@stale stale bot removed the resolution: stale label Dec 2, 2020
@electronicboy electronicboy added the status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. label Dec 2, 2020
@JRoy
Copy link
Member

JRoy commented Dec 2, 2020

FeelsWeirdMan stale bot

@DenWav DenWav marked this pull request as draft April 9, 2021 21:04
@kennytv kennytv deleted the feature/daemon branch May 28, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. status: rebase required type: feature Request for a new Feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants