![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ah-net.processor
Advanced tools
Processes ah-net data obtained from async resources related to network operations.
Processes ah-net data obtained from async resources related to network operations.
npm install ah-net.processor
Table of Contents generated with DocToc
server.listen
tcp client connection
tcp connection
Processes all network related activities found inside the supplied activities
.
Groups them into operations and pulls out meaningful data for each.
Lots of activity data is omitted from the result, therefore make sure to include activities if you need it.
Parameters
$0
Object
Instantiates an tcp server.listen data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
Processes a group of async activities that represent a tcp server listen operation.
It is used by the TcpListenProcessor as part of process
.
Even though the methods here including some private ones are documented, the TcpListenOperation
should not be instantiated and used directly.
Parameters are the same as that of the ah-fs ReadFileOperation
.
The listen contains a lot of useful information about the server.listen()
operation.
The last frame of the init stack tells us where .listen
was called and the
callbacks registered with the server can be found here has well.
If strings were included when the activity resource was captured, we can also obtain the connection key here.
Parameters
info
Object information about the listen step, pre-processed by the ServerListenProcessor
.Returns the summary of processing the group into an operation.
The general properties lifeCycle
and createdAt
are documented as part of
the ah-fs.processor ReadFileProcessor
.
Therefore learn more here.
The parameters { separateFunctions, mergeFunctions }
and return value
are documented as part of the ah-fs.processor ReadFileProcessor
as well.
server.listen
tcpListenOperation._processListen
Instantiates an tcp server connection data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
Instantiates an net.connect
data processor to process data collected via
nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processes the supplied async activities into client connection operations.
Here we consider full operation connect operations only, i.e. we group together 4 operations.
For a sample return value please consult the related tests.
Sample init stack of socket intialization that was created via
net.connect()
:
"at Socket.connect (net.js:932:40)",
"at Object.exports.connect.exports.createConnection (net.js:75:35)",
"at Object.<anonymous> (/Volumes/d/dev/js/async-hooks/ah-net/scenarios/one-connection/client:19:4)",
"at Module._compile (module.js:571:32)",
"at Object.Module._extensions..js (module.js:580:10)"
Code at net.js:932:
this._handle = pipe ? new Pipe() : new TCP();
The 3rd frame from the top tells us where the connection was created.
TODO: this may be different when we create a socket with the slighly lower level API (see: https://nodejs.org/api/net.html#net_class_net_socket) Therefore we need to test/adapt for this case as well.
Sample init stack of getAddrInfo lookup:
"at lookup (dns.js:182:19)",
"at lookupAndConnect (net.js:1053:3)",
"at Socket.connect (net.js:948:5)",
"at Object.exports.connect.exports.createConnection (net.js:75:35)",
"at Object.<anonymous> (/Volumes/d/dev/js/async-hooks/ah-net/scenarios/one-connection/client:19:4)"
Code at dns.js:182
var err = cares.getaddrinfo(req, hostname, family, hints);
Code at net.js 1053:
lookup(host, dnsopts, function emitLookup(err, ip, addressType)
Sample init stack of getAddrInfo lookup for TLS connections:
"at lookup (dns.js:182:19)",
"at lookupAndConnect (net.js:1053:3)",
"at TLSSocket.Socket.connect (net.js:996:5)",
"at Object.exports.connect (_tls_wrap.js:1078:12)",
"at Socket.onserverListening (/Volumes/d/dev/js/async-hooks/ah-net/test/tls-one-connection.client.js:91:10)"
Code at net.js:996
lookupAndConnect(this, options);
In both cases the bottom parts are part of the Socket connect stack and last in stack tells us where that connection was created.
Sample init stack of tcp client connect:
"at connect (net.js:873:26)",
"at emitLookup (net.js:1023:7)",
"at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)",
"at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)"
Code at net.js:873
err = self._handle.connect(req, address, port);
We can clearly see here that it is triggered by the address lookup. The frame1 regex only works in that case as well, i.e. if in some cases no lookup is performed we need to write a smaller processor.
Sample init stack of tls client connect (old):
"at TLSWrap.methodProxy [as connect6] (_tls_wrap.js:327:33)",
"at connect (net.js:923:26)",
"at emitLookup (net.js:1072:7)",
"at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:83:16)",
"at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)"
Updated to latest Node.js:
"at internalConnect (net.js:918:26)",
"at GetAddrInfoReqWrap.emitLookup [as callback] (net.js:1077:7)",
"at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:100:10)"
It is basically the same as a tcp connect init except we have an extra tls related frame. Therefore we use the same regexes, move one frame down
Sample init stack of socket shutdown, it is the same as the socket shutdown on the server side:
"at Socket.onSocketFinish (net.js:240:26)",
"at emitNone (events.js:86:13)",
"at Socket.emit (events.js:186:7)",
"at finishMaybe (_stream_writable.js:509:14)",
"at endWritable (_stream_writable.js:519:3)"
Code at net.js:240:
var err = this._handle.shutdown(req);
Sample init stack of socket shutdown:
"at Socket.onSocketFinish (net.js:240:26)",
"at emitNone (events.js:86:13)",
"at Socket.emit (events.js:186:7)",
"at finishMaybe (_stream_writable.js:509:14)",
"at endWritable (_stream_writable.js:519:3)"
Code at net.js:240:
var err = this._handle.shutdown(req);
Processes a group of async activities that represent a tcp client
connection operation.
It is used by the
TcpClientConnectionProcessor
and HttpClientConnectionProcessor as part of process
.
Even though the methods here including some private ones are documented, the TcpConnectionOperation
should not be instantiated and used directly.
Parameters are the same as that of the ah-fs ReadFileOperation
.
The socket creation activity has three important information points.
We can glean from the stack trace where the client connection was created. We also take the init timestamp to be the beginning of the life of the client connection. On top of that the associated user functions were attached to the owner as event listeners.
Parameters
info
Object information about the establish socket stepThe dns resolution operation (GetAddrInfo) doesn't give us much info, however it
gives us another option to get at the line of code that established the
socket connection, i.e. called connect
.
We only use this option if we couldn't get that information via _processSocket
.
Parameters
info
Object information about the dns lookup stepThe established connection gives us no useful info, so we just record its ids and move on.
Parameters
info
Object information about the established connectionThis function is only used when we are dealing with an http connection which has an http parser.
Parameters
info
Object information about the http parserThis function is only used when we are dealing with a tls connection which.
Parameters
info
Object information about the tls wrapAs is the case for the TcpConnectionOperation
we can only obtain the ids
and the life cycle information of the shutdown resource.
We do have an initStack, but that just points to core code.
However we also pull the destroyed
timestamp from it in order to establish the
full lifetime of the tcp client connection which ends when its shutdown completes.
Parameters
info
Object information about the shutdown of the tcp client connectionReturns the summary of processing the group into an operation.
The general properties lifeCycle
and createdAt
are documented as part of
the ah-fs.processor ReadFileProcessor
.
Therefore learn more here.
The parameters { separateFunctions, mergeFunctions }
and return value
are documented as part of the ah-fs.processor ReadFileProcessor
as well.
tcp client connection
tcpClientConnectionOperation._processSocket
tcpClientConnectionOperation._processGetAddrInfo
tcpClientConnectionOperation._processConnect
tcpClientConnectionOperation._processHttpParser
tcpClientConnectionOperation._processTls
tcpClientConnectionOperation._processShutdown
Sample init stack of http parser we are interested in:
"at Server.connectionListener (_http_server.js:302:10)",
"at emitOne (events.js:121:13)",
"at Server.emit (events.js:216:7)",
"at TCP.onconnection (net.js:1535:8)"
Code at _http_server.js:302:
parser.reinitialize(HTTPParser.REQUEST);
The parser we aren't interested in is allocated right before at _http_server.js:301:
var parser = parsers.alloc();
Instantiates an http server connection data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
Processes a group of async activities that represent a tcp server
connection operation.
It is used by the TcpConnectionProcessor and
the HttpConnectionProcessor as part of process
.
Even though the methods here including some private ones are documented, the TcpConnectionOperation
should not be instantiated and used directly.
Parameters are the same as that of the ah-fs ReadFileOperation
.
The tcp socket is created by core to service a client connection. It has user functions attached which we extract.
The created
timestamp helps us define the life cycle of the connection, as it starts
when the socket is created and ends when the related shutdown is destroyed.
Usually we also see two before and after timestamps but those are mainly only related to the
inner workings of core and are ignored for now.
Parameters
info
Object information about the socket connection, pre-processed by the TcpConnectionProcessor
.We only obtain the ids and the life cycle information of the shutdown resource. We do have an initStack, but that just points to core code.
Parameters
info
Object information about the shutdown of the tcp server, pre-processed by the TcpConnectionProcessor
.This function is only used when we are dealing with an http connection which has an http parser.
Parameters
info
Object information about the http parserThis function is only used when we are dealing with a tls connection.
Parameters
info
Object information about the tls aspect of the connectionReturns the summary of processing the group into an operation.
The general properties lifeCycle
and createdAt
are documented as part of
the ah-fs.processor ReadFileProcessor
.
Therefore learn more here.
The parameters { separateFunctions, mergeFunctions }
and return value
are documented as part of the ah-fs.processor ReadFileProcessor
as well.
tcp connection
tcpConnectionOperation._processSocket
tcpConnectionOperation._processHttpParser
tcpConnectionOperation._processShutdown
The http parser resource gives us a huge amount of information. We have access to the socket here (same as we process in _processSocket). The socket allows grouping by the but also is captured at a point where it has the _httpMessage (unlike the socket we process above).
We also have access to the _httpMessage and the incoming message here. We do pick and choose only a few of those as to not overwhelm the user, on top of that the ah-net pre-processor already removed some info in order to keep the data a decent size. Ergo here we could get lots more data in the future should we need to.
Parameters
info
Object information about the http parser of an http server
or client, pre-processed by the HttpConnectionProcessor
or HttpClientConnectionProcessor
.Instantiates an http client connection data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
Sample init stack of tls socket that was created via
tls.connect
:
"at TLSSocket._wrapHandle (_tls_wrap.js:372:42)",
"at new TLSSocket (_tls_wrap.js:290:18)",
"at Object.exports.connect (_tls_wrap.js:1051:16)",
"at Socket.onserverListening (/Volumes/d/dev/js/async-hooks/ah-net/test/tls-one-connection.client.js:91:10)",
"at emitOne (events.js:126:20)"
Code at net.js:372:
handle = options.pipe ? new Pipe() : new TCP();
The 4th frame from the top tells use where it was created.
Instantiates an tls client connection data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
Instantiates an tls server connection data processor to process data collected via nodesource/ah-net
Parameters and return value are congruent to the ones explained in ReadFileProcessor
Processing algorithm is the same as the one for the readFile processor.
For a sample return value please consult the related tests.
MIT
FAQs
Processes ah-net data obtained from async resources related to network operations.
We found that ah-net.processor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.