workflowproducts / envelope

Publish web apps based on your PostgreSQL database fast!
https://workflowproducts.com/envelope.html
Apache License 2.0
53 stars 2 forks source link

Move idle watcher to each applicable request, and run through valgrind #155

Closed nunziotocci closed 3 years ago

nunziotocci commented 3 years ago

Previously, there was a global idle watcher. This is bad for traceability, but I also found a few spots where there was an increment, and no matching decrement.

I've made it so that whenever a request/connection/whatever is freed, the idle watcher is stopped. This should prevent Envelope from ending up with a constant idle watcher and eating up the CPU.

A side-effect of this is that whenever a request is finished and the idle watcher isn't stopped, libev reads a bad sector and crashes Envelope. I consider this a positive, because now when I'm running the tests I know that everything is fine.

I also went through the entire regression test suite with valgrind. I've been using Windows for development for a while and I slacked off on this. There were a fair amount of issues that have now been fixed having to do with the wrong (or undefined) length being used.