sync-request
sync-request copied to clipboard
`sync-request` leaves orphaned `sync-rpc` processes
A course I teach uses sync-request to allow students to send web requests to test their server. We do this as teaching asynchronous code is too complex for us to cover for beginning students.
However, we have noticed that after their tests finish running, sync-request leaves sync-rpc processes alive. Although these don't have a meaningful impact for individual users, they place a huge amount of strain on our systems when multiplied over 600 students.
Our temporary workaround is to add a posttest script which kills these processes after Jest exits.
pkill -f 'node_modules/sync-rpc/lib/worker.js' > /dev/null 2>&1
However, this is a poor solution, which causes students' code to break in unexpected ways if they also use sync-request in their server if they don't also restart their server between test runs.
Error: nativeNC failed:\n\n
The optimal solution would be for sync-request to properly kill its sync-rpc subprocesses when its host process exits.