agents: fix ExitEvent condition handling
A couple of fixes here:
- Both the `uv_mutex_t` and `uv_cond_t` should be initialized before
defining the lambda.
- Add a boolean variable to make sure we're not waiting forever in the
case the lambda code is run before reaching the `uv_cond_wait()`.
agents: fix synchronized code in GrpcAgent
It should also cover the `start_profiling` fn execution.
test: unflake test-nsolid asset tests
Increase the timeouts a bit to make sure the heapSampling and the
cpuProfile are actually stopped before trying to start a new one.