Skip to content

V0.7.12 actix-web::ws can not run in arm-linux #545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lygz5016 opened this issue Oct 12, 2018 · 10 comments
Closed

V0.7.12 actix-web::ws can not run in arm-linux #545

lygz5016 opened this issue Oct 12, 2018 · 10 comments

Comments

@lygz5016
Copy link

The run error message:

thread 'main' panicked at 'could not initialize thread_rng: All entropy sources failed (permanently unavailable); cause: OS RNG not yet seeded (not ready yet); cause: Resource temporarily unavailable (os error 11)'

Where thread_rng is used in the source code:

  1. src/ws/frame.rs line: 329 let mask = rand::random::<u32>();
  2. src/ws/client.rs line: 302 let sec_key: [u8; 16] = rand::random();

Only use ReadRng on my target(arm-unknown-linux-gnueabi):
let mut rng = read::ReadRng::new(std::fs::File::open("/dev/urandom").unwrap());

@fafhrd91
Copy link
Member

i dont know how to fix this.

@DoumanAsh any ideas?

@DoumanAsh
Copy link
Contributor

DoumanAsh commented Oct 14, 2018

@lygz5016 Are you use we cannot use at least EntropyRng?

Disregard that, I looked at source code for ThreadRng and it uses EntropyRng

I feel like it is strange that it is not possible to use it on your system since it is still Linux with /dev/urandom I wonder if there is similar issue in rand crate

@DoumanAsh
Copy link
Contributor

This PR might help with such issues rust-random/rand#579

It would allow user to set own source of entropy.
I don't think we should get away from using thread_rng, but it is still questionable why it fails on arm linux.

@lygz5016
Copy link
Author

@DoumanAsh I tried to use EntropyRng, but it still can't work.

The use of OsRng is blocked.

So I can only use read::ReadRng::new(std::fs::File::open("/dev/urandom").unwrap());

I don't think we should get away from using thread_rng, too.

@DoumanAsh
Copy link
Contributor

I think it might be worth asking from rand guys about it.
Since your target is linux I'm surprised that EntropyRng fails...

@lygz5016
Copy link
Author

This is a very strange question. I'm not sure if it's a system cause, and it could not initialize without an entropy source.

@DoumanAsh
Copy link
Contributor

It would explain the OsRng problem, but EntropyRng is intended to work on common systems as guaranteed way to initialize random(when HW's random fails you)

In any case I would prefer to not move away from thread_rng itself, I'll try to check rand crate myself on my raspberry pi.

@fafhrd91
Copy link
Member

@DoumanAsh can we do anything?

@DoumanAsh
Copy link
Contributor

I think we cannot unless random's author will tell that EntropyRng cannot be used on arm platform.
Otherwise we could only do platform specific code as @lygz5016 suggested, but I don't like this idea

@fafhrd91
Copy link
Member

@DoumanAsh thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants