-
Notifications
You must be signed in to change notification settings - Fork 2
P2P controller issues #25
Description
1
worker-rs/src/controller/p2p.rs
Line 156 in d26c626
| if !self.logs_storage.is_initialized() { |
And the query is silently dropped? No good!
2
worker-rs/src/controller/p2p.rs
Line 234 in d26c626
| .unwrap_or_else(|_| error!("Cannot send query result: queue full")); |
It is strange to ignore back pressure and to continue accept queries while there are troubles with sending them back!
Similar thing happens here:
worker-rs/src/controller/p2p.rs
Line 139 in d26c626
| warn!("Queries queue is full. Dropping query from {peer_id}"); |
When application is not able to process requests it should convey that to the transport level and to stop wasting resources on accepting and verifying packets that it is about to drop.
However, the problem is not just about queue puts.
I would implement request processing pipeline roughly as follows.
- No queue in the message receiving loop
- CU and MAX_PENDING_QUERIES limits are checked and the error is returned to the user immediately if they where exceeded (with
awaiton response queue). - Query processing procedure would be launched with
tokio::spawn()and would include- Parsing
- Query execution
- Log record formulation and writing
- Send queue put with
await.
3
worker-rs/src/controller/worker.rs
Line 104 in 17bbf99
| query_str: String, |
No need for ownership.
4
max query size limit in the currently linked version of the transport lib is set to 512 kb.
pub const MAX_QUERY_SIZE: u64 = 512 * 1024;It should be less.
The limit for the query itself should be set exactly and explicitly to 256 kb.
Transport message size should be adjusted accordingly.
For the future, allocation check should happen before message arrival and validation.