Comments (3)
After some preliminary testing on this issue. I feel like this is the issue that causes the need for the overseer, though it seems that the single shared rendezvous used for transmitting both task handles may also be untenable.
The test worked as follows. I gave both the provider
and consumer
of an AsyncElementLink
a Sender
and Receiver
handle into a bounded channel that takes things of type Task
. The crucial observation we saw was that with two channels both the provider
and consumer
could have their task handles parked in their respective waking channels, go to sleep, and cause a deadlock. To remedy this issue, I instead only created one bounded channel of size one. Logically, with only one slot total to place a Task
into, there cannot be two parked tasks. Taken from the consumer
side, when it notices a full packet channel, it should try to awaken the provider
and then go to sleep. The consumer is now awaiting the provider to remove some packets from the channel so it can continue to make forward progress.
With only one channel, the general strategy to sleep would be:
- Gather current task handle
- Try to send task handle onto task rendezvous.
a. No error: go to sleep
b. Error::Full(), proceed to step 3
c. Error:Disconnected, schedule self to awaken again. Maybe panic!? - Rendezvous is full, implying the
provider
is asleep,try_recv()
from rendezvous to make space for our task handle. - Now we have the
provider
task handle, retrytry_send()
with our task handle onto the rendezvous. - Call
provider_task.notify()
then go to sleep.
We would think this would resolve the deadlock, since only one of the sides could be asleep awaiting the other at a time, but this code has an error. In step 2, where we get a trySend::full()
error, we then immediately try_recv()
the task in the channel, so we can send ours onto the channel. Unfortunately, we get the error on try_recv()
that the channel is empty! This implies something is wrong with our model on how channels work, and we may need to use something more exact to make sure this deadlock doesn't happen.
I also disabled the overseer for my tests, so the only two things that can talk to the task rendezvous is the consumer
and provider
.
from route-rs.
I want to try using https://docs.rs/crossbeam/0.7.2/crossbeam/atomic/struct.AtomicCell.html instead of a channel to store the Task. I think I can use the swap
function to do what we want and resolve the deadlock.
from route-rs.
The above AtomicCell works, the code is in progress of getting cleaned up for PR. Will probably push three PRs, one for each Link type.
from route-rs.
Related Issues (20)
- Packet::Ipv6Packet::Set_src_addr
- Packet::Ipv6Packet::Set_dest_addr
- Packet::Ipv6Packet::ExtensionHeaders.
- Packet::Ipv6Packet::Payload
- Packet::Ipv6Packet::Set_payload
- BlackHoleLink: Create test for multiple input streams. HOT 1
- Packets::Ipv4::set_options
- Discussion on which Links should be finalized.
- Create non-IP L3 packet types.
- Non-static packet lifetimes
- Link Rename
- Update graphgen to use new Link API
- Create an integration test with af_packet and route-rs-packet libraries HOT 1
- Use pcap for e2e tests
- Rework IpProtocol Type
- Build minimal static router HOT 1
- How do I pronounce this? HOT 1
- Remove SmolTCP dependency from Runtime
- Implement userspace TUN support
- Log Link
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from route-rs.