Skip to content
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

server hanging after running for over 30 seconds #218

Closed
freiguy1 opened this issue May 15, 2015 · 7 comments
Closed

server hanging after running for over 30 seconds #218

freiguy1 opened this issue May 15, 2015 · 7 comments

Comments

@freiguy1
Copy link

I've a Debian server and I'm trying to run the release version of my simple web application using nickel.rs, and after it's been running for as little as 30 seconds, it stops responding. I added a middleware to log every request, and that doesn't even get reached. When I use curl on the server pointed to localhost, that acts the same way as the browsers. They just spin indefinitely.

The worst problem is that I try the same code/same version of rust on a different Ubuntu server and it never hangs.

Any idea how to remedy this problem?

@ninjabear
Copy link
Contributor

If you open a socket using another tool on that port, does the same problem occur? Lots of problems like this I've found are due to router problems, especially if any NAT traversal is taking place somewhere

@freiguy1
Copy link
Author

Good thoughts, however if you're talking physical router problems, I thought my curl localhost:3000 would eliminate that from the equation. As far as running it on a different port, I can try. The whole story is that I am hosting it on port 3000 and using a virtual host in apache to route a url to localhost:3000. So I'm actually only hitting it through port 80 when accessing it remotely. And I've many things (no rust webapps yet though) hosted on other ports using virtual hosts @ port 80 w/ apache on that machine - so that layer shouldn't be the issue.

@ninjabear
Copy link
Contributor

Oh ok.

Have you tried subbing out your code for a nickel hello world and seeing if you get the same result? Just trying to isolate the problem a bit more.

#[macro_use] extern crate nickel;

use nickel::Nickel;

fn main() {
    let mut server = Nickel::new();

    server.utilize(router! {
        get "**" => |_req, _res| {
            "Hello world!"
        }
    });

    server.listen("127.0.0.1:6767");
}

Is it after a certain number of requests? Is it linked to the number of requests at all do you think?

@ninjabear
Copy link
Contributor

The thing that steered me towards it being a config issue was that the same code works fine on your ubuntu machine - odd because everything apart from the config should be the same.

Anything special in /etc/hosts or iptables?

@freiguy1
Copy link
Author

Thanks for the help! I think I'm leaning toward blaming apache as of now. After checking the apache error logs, I get something similar to this serverfault problem. And after the suggested changes, it's working as of now! I'm curious as to what's different between the nickel server and the other types of sites I'm running (ghost blog and a few Play! Framework applications).

@Ryman
Copy link
Member

Ryman commented May 15, 2015

@freiguy1 If apache is using keepalive, then it's likely causing issues due to hyperium/hyper#368 (Apache isn't really at fault, just keepalive being badly handled)

Let me know if you find a different root cause though!

@freiguy1
Copy link
Author

@Ryman Ok, that makes a lot of sense. That answers my question

...what's different between the nickel server and the other types of sites I'm running

Thanks for the input!

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