plow-technologies / inferno

A statically-typed functional scripting language
MIT License
4 stars 1 forks source link

WIP: A Concurrency Tester for Inferno-VC (and other servant servers) #37

Open siddharth-krishna opened 1 year ago

siddharth-krishna commented 1 year ago

This issue documents partial progress towards testing inferno-vc-server for concurrency bugs (#19 , #36).

The basic idea is to use the servant-quickcheck package to test the VC server on arbitrary requests. In order for this to unearth concurrency bugs, the following steps are needed:

  1. Add a concurrent harness to servant-quickcheck so that it makes requests from multiple threads simultaneously. (Partial progress towards this is on my fork here.)
  2. The concurrent harness above is based on the stale package pqc (see my fork for GHC 9), but it needs improvements like early exit when one thread fails the test, logging the concurrent history of requests that caused an error, etc.
  3. Purely random requests are not very good at exercising race conditions and catching bugs. For example, inferno-vc needs to be called with successive stores on the same script in order to exhibit some of the bugs (#36). We should modify the generator to generate requests from a small pool of object hashes so that the tests are more realistic. (Partial progress on the sidk-conc-tests branch)
  4. The default arbitrary generator for Expr generates huge expressions, which causes tests to time out silently. A hacky fix is to add let reqs = resize 2 $ ... in servant-quickcheck's serverSatisfiesMgr. A better way forward would be to also limit the expressions used in test requests.

(CC: @smurphy8 )