Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main objective of this PR is to implement a robust version of an Athena TCP server that can accept incoming requests of size up to 4 GB and handle those using native MLton threads instead of forking a separate process. Forking has a distinct disadvantage: it is inherently stateless (since the child process gets its own replica of the global state), so it's not possible to satisfy a client request with side effects (say, a definition, which updates the global environment, or an assertion, which updates the global assumption base), as the side effects will take place on the state of the child process and will vanish when that process completes.
The new implementation has an improved readAll function. Assuming that the client encodes the length of the payload into the first 4 bytes of its request, the server is guaranteed to read the entire payload properly in a loop.
A sample Python client is also checked in for convenience.
This PR also includes:
(1) A new version of mlton_main.sml that allows for more flexible ways of calling Athena; and
(2) Two scripts, make_athena_binary_for_linux and make_athena_binary_for_mac, that can be used to
manually compile Athena binaries from the sources.