servo / ipc-channel

A multiprocess drop-in replacement for Rust channels
Apache License 2.0
847 stars 126 forks source link

router tests are non-deterministic because of shared router #106

Open vvuk opened 8 years ago

vvuk commented 8 years ago

All of the tests use the global ROUTER RouterProxy, meaning that test runs end up depending on test order, number of threads, etc.

If everything's working okay, this isn't an issue -- but right now I'm chasing down an issue where every router test passes individually, and they will often pass when run in sequence, but every once in a while one will fail with a hard-to-track-down unwrap() panic after a previous one succeeded.

antrik commented 8 years ago

You can probably avoid the non-determinism by runnig with RUST_TEST_THREADS=1. I agree though that this is not ideal...

Note that such intermittent failures actually do indicate real problems I believe -- either in some of the other test cases (leaving something in an unclean state), or in the actual implementation. If you could track them down, that would be highly appreciated.

vvuk commented 8 years ago

It was a problem in my implementation (what I suspected to begin with -- basically an accidental stomping of a buffer when a few async things were going on at once). RUST_TEST_THREADS=1 helps for sure, but it still ends up being dependent on what tests you run if you don't run all of them.