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

adding await ystore start method in prepare method #299

Merged
merged 1 commit into from
May 3, 2024

Conversation

jzhang20133
Copy link
Collaborator

@jzhang20133 jzhang20133 commented May 2, 2024

@jzhang20133 jzhang20133 requested a review from Zsailer May 2, 2024 17:52
Copy link
Contributor

github-actions bot commented May 2, 2024

Binder 👈 Launch a Binder on branch jzhang20133/jupyter-collaboration/2.x-new

@Zsailer
Copy link
Member

Zsailer commented May 2, 2024

Test failures appear to be related to: jupyter-server/jupyter_server_fileid#75

@@ -111,6 +111,7 @@ def exception_logger(exception: Exception, log: Logger) -> bool:
file = self._file_loaders[file_id]
updates_file_path = f".{file_type}:{file_id}.y"
ystore = self._ystore_class(path=updates_file_path, log=self.log)
await ystore.start()
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the general case, starting a service can be blocking. Actually, after jupyter-server/pycrdt-websocket#42 starting a YStore will be.

Suggested change
await ystore.start()
self.create_task(ystore.start())
await ystore.started.wait()

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, starting the YStore should not be done here but in the DocumentRoom, since it is optional.
Also, you might want to stop the YStore when stopping the YRoom.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think adding await in the DocumentRoom is a good idea and it also help prevent starting the room at two places which could cause race condition as well. I will make that change.

@jzhang20133 jzhang20133 merged commit d4186b7 into jupyterlab:2.x May 3, 2024
18 of 20 checks passed
@@ -100,6 +100,7 @@ async def initialize(self) -> None:
# try to apply Y updates from the YStore for this document
read_from_source = True
if self.ystore is not None:
await self.ystore.started.wait()
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jzhang20133 You didn't apply my suggestion.

Copy link
Collaborator Author

@jzhang20133 jzhang20133 May 3, 2024

Choose a reason for hiding this comment

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

@davidbrochart Following your suggestion, we moved the logic here in document room. By not applying your suggestion, are you referring to this lineself.create_task(ystore.start())? I did not add ystore.start logic here because ystore.start() is also called in yroom.broadcast_update() method. And if ystore has been started and then it is started again, an exception could be thrown and the exception could kill task groups. Instead of triggering starting of ystore at multiple places and exception handling at multiple places, we choose to simply wait for the ystore to be started, which is a great idea that you have suggested.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, @jzhang20133. I'll let David respond to this when he's back in office next week and we can create a follow-up PR if needed.

@davidbrochart's point below stands. If we do something different from his suggestions, we should include an explanation and wait for his response before merging.

This one is on me folks. I missed this difference in the change before approving the PR. Let's learn from this and make sure we're properly patient going forward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Zsailer @davidbrochart I will make sure I add explanation if change is made differently from suggested and wait for @davidbrochart 's inputs and approval on the difference in the future PRs. Thank you both for your patience and help on reviewing PRs! Really appreciated!!!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@davidbrochart For this specific change, please feel free to let us know your thought here about not adding this line self.create_task(ystore.start()). I can address accordingly in another PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAICT this PR doesn't start the YStore, but just waits for it to be started?
I opened #302 and #303.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, it just wait for it to be started by yroom.broadcast_update() method. If yroom is started twice, an exception could be thrown and the exception could kill task groups. We need to add exception handling for ystore.start() if it get started in multiple places.

@davidbrochart
Copy link
Collaborator

@Zsailer I don't think we should merge when there are requested changes that were not made, in my opinion. We should at least justify that these changes are not needed, but the best would be to wait for the reviewer's answer.
I understand that you want to iterate quickly, but reviewing is also taking a lot of my time, so it should be taken into consideration.

@Zsailer
Copy link
Member

Zsailer commented May 3, 2024

I don't think we should merge when there are requested changes that were not made

This was my mistake, @davidbrochart, an oversight in my follow-up review. I'm so so sorry.

I thought @jzhang20133 applied your suggestions after moving that chunk of code from the handlers to the document room. I now see that she dropped one of the lines. This one is on me for not flagging this during the review. I will take this as a note to slow down.

reviewing is also taking a lot of my time, so it should be taken into consideration.

❤️ absolutely, @davidbrochart. And we cannot express enough how much we appreciate you for this.

Please know that this wasn't an attempt to bypass or ignore your review. It was an oversight on my part, and I apologize for not giving your time+review the proper attention ❤️

@Zsailer
Copy link
Member

Zsailer commented May 3, 2024

I understand that you want to iterate quickly

Yes, you're right the call this out. It's not a good excuse, but helpful to be transparent here. This issue was blocking us from putting on a "real" system with real people testing it, so we're trying to get these libraries in a useable state ASAP (they are pretty brittle today when running in a cloud environment where RTC is most useful). In the long run, I hope this brings helpful and powerful feedback for the project.

That said, we don't believe this gives us the right to bypass your reviews and I hope you don't feel that we're doing that. Please call it out again if you do. We want to get this right.

@davidbrochart
Copy link
Collaborator

No worries Zach and Jialing, I hope my message was not too dry.
Be sure that I really appreciate the efforts you're putting into making Jupyter collaboration more robust, and keep up the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants