[SOLVED] Lock is not being released in multithreaded context thus everything runs serialized giving single threaded performance

UPDATE: The problem is fixed. It was due to the local variable i keep the channel in. Since it was valid untill the end of the scope so the lock was.
here is the my version of multi threaded web server from the book except a couple variable name changes its identical to the one in the book.
If i run this code and fire requests to it every 100 ms this is what i get, Only one thread at a time executes the code resulting me getting response back each 2 seconds rather than 4 times in 4 seconds

You should really post the reddit link, seeing you already got some answers there: https://www.reddit.com/r/rust/comments/9wd6wh/rust_thread_pool_example_blocks_the_entire_system/.

1 Like

Yes right now i fixed my issue it was about the block of local variable i put the ch in

seems reference style links aren supported so i altogether changed it to []() style