RPC_toy: First version with server, client and basic requests
What
This is a mini-project meant for the crew investigating the resources leak from the RPC layer.
The node.ml file introduces a server which accepts curl requests on the 8080 port.
For now, it only accepts a sleep request, which prints a sleeping message at fixed intervals, continuously.
Why
With the leak.sh script, we test the scenario that we talked about in the Leak document, the section about detecting EOF in cohttp.
How
Just run the leak.sh script.
Manually testing the MR
Case 1: current implementation of cohttp
$ cd ~/tezos/contrib/RPC_toy
$ ./leak.sh
Entering directory '/Users/gabrielmoise/tezos'
Starting node server
Node PID: 17082
[Server response] : Entering directory '/Users/gabrielmoise/tezos'
[Server response] : Leaving directory '/Users/gabrielmoise/tezos'
[Server response] : Server running on port 8080
Make self-loop request to server
[Server response] : Cohttp connection on 1
[Server response] : %!
[Server response] : I slept
[Server response] : I slept
[Server response] : I slept
[Server response] : I slept
Attempting to cancel the self-loop request
Cancelled the self-loop request
[IMPORTANT] Cohttp connection did NOT CLOSE
Attempting to stop the node server
Stopped the node server
Naturally, as indicated by the IMPORTANT message, we can see that the cohttp connection did not close.
Case 2: Vendoring cohttp and fixing the EOF problem. Assuming that this has been done to prevent the leaking behaviour, you can go back to the leak.sh script to test it.
$ cd ~/tezos
$ make
$ cd ~/tezos/contrib/RPC_toy
$ dune build
$ ./leak.sh
Entering directory '/Users/gabrielmoise/tezos'
Starting node server
Node PID: 62719
[Server response] : Entering directory '/Users/gabrielmoise/tezos'
[Server response] : Leaving directory '/Users/gabrielmoise/tezos'
[Server response] : Server running on port 8080
Make self-loop request to server
[Server response] : Cohttp connection on 1
[Server response] : %!
[Server response] : I slept
[Server response] : I slept
[Server response] : I slept
[Server response] : I slept
Attempting to cancel the self-loop request
Cancelled the self-loop request
[Server response] : Cohttp connection closed
[IMPORTANT] Cohttp connection CLOSED
Attempting to stop the node server
Stopped the node server
And now the cohttp connection has been closed
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR