faern / oneshot

Oneshot Rust channel working both in and between sync and async environments
74 stars 9 forks source link

Figure out why loom fails on tests with large messages #12

Open faern opened 4 years ago

faern commented 4 years ago

Currently the test that sends a [u8; 4096] is gated to run only when not under loom. This causes invalid memory access under loom and I have no idea why.

The invalid memory access happens when the receiver.recv() method is called. The weird thing is that it happens before the method even runs:

    ...
    eprintln!("This is printed");
    receiver.recv();
}
impl Receiver {
    fn recv() {
        eprintln!("This is NOT printed");

So it's like if just calling the function is invalid memory access. Access to undefined memory is more exactly what it says.

Another weird thing is that this depends on the amount of code in the recv method and the size of the message. When writing this it's triggered when the message reach around 500 bytes. But if I start removing code from the recv method it starts working again.