NODE.JS RUNTIME VERIFICATION

Davide Ancona, Angelo Ferrando, Luca Franceschini, Viviana Mascardi

International Runtime Verification Competition
18th International Conference on Runtime Verification
Limassol, Cyprus, 12th November 2018

NODE.JS

JavaScript execution environment based on an asynchronous computational model

Challenges:

  • Asynchronous functions & callbacks
  • Anonymous functions heavily used
  • Lots of bookkeeping needed
  • Performances are crucial

APPROACH

Based on code instrumentation, with Jalangi

Every function call is registered, and the trace contains all call information in JSON

Trace expressions are used as formalism
Prolog implementation available as oracle

Two benchmark suites:
file system API and HTTP API

HTTP EXAMPLE

\tau = \langle\texttt{cbId};\mathit{createServer}(\texttt{cbId}):\tau'\rangle\\ \tau' = \epsilon \lor \langle\texttt{respId};\mathit{callback}(\texttt{cbId},\texttt{respId}):(\tau_w|\tau')\rangle\\ \tau_w = (\mathit{write}(\texttt{respId}):\tau_w) \lor (\mathit{end}(\texttt{respId}):\epsilon)
τ=cbId;createServer(cbId):ττ=ϵrespId;callback(cbId,respId):(τwτ)τw=(write(respId):τw)(end(respId):ϵ)\tau = \langle\texttt{cbId};\mathit{createServer}(\texttt{cbId}):\tau'\rangle\\ \tau' = \epsilon \lor \langle\texttt{respId};\mathit{callback}(\texttt{cbId},\texttt{respId}):(\tau_w|\tau')\rangle\\ \tau_w = (\mathit{write}(\texttt{respId}):\tau_w) \lor (\mathit{end}(\texttt{respId}):\epsilon)
var server = http.createServer(function (req, res) {
  res.writeHead(200);
  res.write('okay');
  // BUG! missing res.end()
});

CRV'18

By Luca Franceschini

CRV'18

  • 744