piknik icon indicating copy to clipboard operation
piknik copied to clipboard

WIP: support usage of r2d2 get_timeout

Open infinity0 opened this issue 3 years ago • 1 comments

Works towards implementing #650, however it only implements the sync/r2d2 part of it which is what we're using.

Right now I'm not familiar with APIs of tokio/async-io to do the async part of it, and it looks like the pool functionality is implemented "from the ground up" in async_impl.rs rather than delegating to another crate. Actually I am not sure if the existing async behaviour is correct - the only mention of max_size is when existing active connections become inactive and then get recycled, but there appears to be no logic that limits new connections when there are >= max_size active connections. By contrast r2d2 (which is sync) will wait for connection_timeout for a connection to become available, which is where the DoS vector comes in, and is mitigated via the use of get_timeout

infinity0 avatar Jul 06 '21 13:07 infinity0

(I am not currently intending to finish this PR, I intend this only as a demonstration of what I meant in #650. It would be good if the maintainers pick this up.)

infinity0 avatar Jul 06 '21 13:07 infinity0