inspector: split HTTP/WS server from the inspector#9630
inspector: split HTTP/WS server from the inspector#9630eugeneo merged 0 commit intonodejs:masterfrom eugeneo:socket_server
Conversation
|
Related test failures on the OS X buildbot: https://ci.nodejs.org/job/node-test-commit-osx/6038/nodes=osx1010/console - some inspector cctests are failing. |
|
I fixed the issues CI identified. New CI run (https://ci.nodejs.org/job/node-test-pull-request/4863/) seems to pass on all platforms, except ARM. Failures there seem to have to do with infrastructure failures unrelated to this PR. |
node.gyp
Outdated
src/inspector_agent.cc
Outdated
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Returning const values (not references) is kind of odd. Doesn't g++ complain about that?
There was a problem hiding this comment.
It did not complain (neither did clang/Mac), I removed the const none the less.
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Why is this necessary? An explaining comment would be good.
There was a problem hiding this comment.
This is a temporary "command" to stop accepting new connections. In next pull request there will be a better API with meaningful requests as opposed to magical strings...
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
You don't seem to reset delegate_ to nullptr anywhere.
src/inspector_agent.cc
Outdated
There was a problem hiding this comment.
Ditto for server_, it looks like.
src/inspector_agent.h
Outdated
There was a problem hiding this comment.
Unnecessary whitespace change.
src/inspector_agent.h
Outdated
There was a problem hiding this comment.
These methods don't seem to be used or defined anywhere.
There was a problem hiding this comment.
Removed, at some points was considering a slightly different API.
src/inspector_socket_server.cc
Outdated
There was a problem hiding this comment.
Can you line up the arguments?
src/inspector_socket_server.cc
Outdated
There was a problem hiding this comment.
Yes, this ultimately remained in inspector_agent.cc...
|
@bnoordhuis Thank you for reviewing it. I addressed your comments (and also did another pass through function names and such). Please take another look. |
|
I am looking to rework this quite a bit, to define an easier to use API. Please do not review it for now. |
|
PR had been reworked, please review. I replaced the Session object with an integer session_id, it simplified the API. |
src/inspector_socket_server.cc
Outdated
There was a problem hiding this comment.
Not at all critical but doesn't it make more sense to use a std::set?
src/inspector_socket_server.cc
Outdated
src/inspector_socket_server.cc
Outdated
There was a problem hiding this comment.
Can you share this code with test_inspector_socket.cc?
There was a problem hiding this comment.
That test is due for a more comprehensive cleanup so I will do it then (this will require adding new files, etc).
There was a problem hiding this comment.
Teeny tiny nit: we usually put a space before the <.
There was a problem hiding this comment.
Can you fix the long lines in this file?
|
@bnoordhuis Thank you for the review. I uploaded updated commit, please take another look. |
|
@bnoordhuis I've updated the change, fixing the cpplint comment on the new test. |
|
I see a FreeBSD test failure that does not seem to be connected to this change. |
src/inspector_socket_server.cc
Outdated
There was a problem hiding this comment.
Suggestion: s/sserver/socket_server/ - the difference between server and sserver is very subtle.
There was a problem hiding this comment.
Isn't the linter complaining about a using directive outside a namespace?
There was a problem hiding this comment.
I moved the directives inside the namespace. Linter was fine - don't know if it is because of its settings.
|
Looks like https://ci.nodejs.org/job/node-test-pull-request/5271/ is all green but some glitch is preventing thew results to be reported back to GitHuib. |
|
Landed as 42da740 |
|
@Fishrock123 this is another example of something that likely should not have gotten the |
|
@eugeneo should this be backported to v6 or is this an example of something that requires the latest version of inspector api? |
|
This is a refactoring and does not require a new V8 inspector. I am not sure if it is needed for v6 (I'm not familiar with the policies) as main goal is to enable development of new features. |
Both our team experiments and some embedder request indicate a potential in implementing alternative transport for inspector - e.g. IPC pipes or custom embedder APIs. This change moves all HTTP specific code into a separate class and is a first attempt at defining a boundary between the inspector agent and transport. This API will be refined as new transports are implemented. Note that even without considering alternative transports, this change enables better testing of the HTTP server (Valgrind made it possible to identify and fix some existing memory leaks). PR-URL: #9630 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Both our team experiments and some embedder request indicate a potential in implementing alternative transport for inspector - e.g. IPC pipes or custom embedder APIs. This change moves all HTTP specific code into a separate class and is a first attempt at defining a boundary between the inspector agent and transport. This API will be refined as new transports are implemented. Note that even without considering alternative transports, this change enables better testing of the HTTP server (Valgrind made it possible to identify and fix some existing memory leaks). PR-URL: #9630 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
|
If this is backported it should be backported with #10657 |
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
inspector: HTTP server code was reworked and moved to a new file. No impact if the inspector is not started.
Description of change
Both our team experiments and some embedder request indicate a potential
in implementing alternative transport for inspector - e.g. IPC pipes or
custom embedder APIs. This change moves all HTTP specific code into a
separate class and is a first attempt at defining a boundary between the
inspector agent and transport. This API will be refined as new
transports are implemented.
Note that even without considering alternative transports, this change
enables better testing of the HTTP server (Valgrind it possible to identify
and fix some existing memory leaks).
CC: @ofrobots