-
Notifications
You must be signed in to change notification settings - Fork 17
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
Investigate using forkProcess for running snippets #195
Comments
This refactoring introduces two changes: 1. IdeSessionUpdate is more structured, so that we can inspect them and potentially allow them to be executed while the session is in Running mode. 2. Removed various fields from IdeIdleState and moved them to a new PendingRemoteChanges datatype, which furthermore is an argument to a _new_ IDE state IdePendingChanges -- which happens only after the initial session start or a session restart. This makes it clear that there can not be any pending changes in idle mode, normally -- and (this was the original purpose) definitely no pending changes in running mode. All this sets things up for #176, but a full implementation of #176 will be delayed until #195.
@snoyberg Quick question for you: do you guys use |
@edsko Looks like we're not using it at all, feel free to remove it. |
@snoyberg Ok, great, thanks for checking! |
@snoyberg So we think it's less than a day's work to get it ready for you to try out. So we'll do that and also start on our own further tests. We should be able to squeeze that in within the next few days. Obviously because we've not done extensive tests ourselves we're not expecting flawless results from your tests. In particular we're currently aware that cancelling of snippets is not always working reliably, though we can change it to kill the whole process. Also, as mentioned the debugging API is not covered, and we currently make no attempt to track and shut down the running snippet processes when the IdeSession is terminated. Depending on your point of view this could be a feature or a bug: it certainly means that you have to always use the RunActions to the end (either normal or forced termination). |
Thanks for the update. I'm not worried about the lack of tracking of running snippet processes, but thank you for pointing it out. I'll look forward to hearing when I can start testing this branch. |
@dcoutts @snoyberg Branch
This affects both the client and the server to be sure to use both (a mismatch should be detected). |
I kicked off our test suite against this branch. Overall, this is looking very good. A few minor issues I noticed:
I believe it came from the test "downloads binary which embeds static files"
|
Sure enough, replacing a call to I'm pushing this codebase to our QA environment (https://learning-site-qa.fpcomplete.com/), and will try to do some testing on it next week (I'm out of the office on Sunday and Monday). Pinging @mgsloan as well, please look over this issue to get a basic idea of what's going on, and if you have a chance, do some testing on QA once this is built. |
I'm glad that things seem to be working reasonably okay. Mind that while it's great to be testing this now, I would certainly recommend against using it in production just yet.. Also, can you confirm if that |
Oh, hah, I just ran this against the 7.8 server (rather than the 7.4 server that I had been testing with and I got that |
It happens fairly reliably if I run the following two tests:
I'm not planning on putting this in production immediately, but I would like to get an idea in the next few days whether this will ultimately be production quality, so I can make the necessary changes on our side. I've held up implementing our optimized runs feature for word on this branch, and I do need to either implement it based on this code, or figure out another way to make this work. |
One more note to myself: if we move to this branch, I need to add code to call interrupt/forceCancel in the event of the project being terminated, since killing IdeSession is no longer sufficient. (Yes @edsko, your notes above make this clear, but putting it as an explicit note to myself like this makes it less likely that I'll forget to do so.) |
yes, that does look like that is feasible. I have found no problems with |
I think the problem with the There is an independent problem however, of which I have not yet tracked down the cause. I will look at that first. |
Note to self: another issue is that terminated snippets currently are zombies until the main server terminates. |
Seems to work well for me on QA! Beyond needing to change the global process state, another reason to use |
There appears to be an issue that the last message sent by the server (final outcome of the snippet) does not always arrive at the client ( |
@mgsloan Indeed, that's true. That problem is now implicitly gone. |
Actually, we don't want each snippet running in its own temporary directory. One of the things we're trying to get for free out of this change is allowing us to update data files while a snippet is running. |
@snoyberg Yes, but presumably updating data files for one snippet should not affect data files for all other snippets running concurrently? |
In theory, yes. In practice, what we want is that when the user updates a data file for the project, all running snippets immediately see the updated data file. We also don't intend to let users actually run snippets concurrently. So I think the simplest solution is to just have the project itself and all running snippets share a data file directory. I'm open to other ideas. |
Ah, okay. Well that's easier for me, so I won't object :) |
@snoyberg I have just pushed a commit to the @Mikolaj I am now no longer seeing this problem with the #58 test. Can you please verify on Linux? |
I'm now using forkProcess for |
The
IdeSession
's API for running snippets puts the session into a "running" mode where further updates to sources and data files are not allowed. (Of course underneath the reason is that the snippet blocks the use of the GHC session.) It would be preferable for using theIdeSession
if there were no "running" mode and if a running snippet were mostly independent of the session it was started from. It would allow further updates to the code and info queries etc. It would allowisolation-runner
to avoid keeping an extra copy of the session just for the purpose of running snippets, and this would simplifyisolation-runner
and use fewer resources.So, the task is to investigate if we could fork the whole
ide-backend-server
process when we run a snippet, so that that process can continue mostly independently, and the parent can be used to continue to do session updates.This would involve:
forkProcess
action, which is known to be somewhat hairy and not brilliantly tested. (We know of at least one deadlock during shutown)And anything else that we think of or run into as we investigate this.
@snoyberg has allocated 2 days initially to the investigation. If it looks like it might pan out, it will certainly need plenty of time reserved for testing to make sure
forkProcess
does not bite us.The text was updated successfully, but these errors were encountered: