Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Running ApacheBench against empty RC1 template using kestrel results in timeout #605

Closed
christiansparre opened this issue Feb 1, 2016 · 11 comments

Comments

@christiansparre
Copy link

Hi, I'm having trouble doing some simple benchmarks using ApacheBench on a project we are experimenting with.

I'm on Windows 7 with rc1-update1.

When trying to use ApacheBench the tool fails with the below message, I tried creating a new project using the empty RC1 template, this also failed.

ab -c 1 -n 100 http://localhost:5000/
Benchmarking localhost (be patient)...
Test aborted after 10 failures

apr_socket_connect(): No connection could be made because the target machine actively refused it.   (730061)

When using IISExpress from with VS it works fine. I have tried using different ports with kestrel with no luck. I have tried with the latest available RC2 builds with no luck. I tried the ab -k switch (KeepAlive) as I was told that might be the issue.

Any idea what might be causing this?

@khellang
Copy link
Contributor

khellang commented Feb 1, 2016

@christiansparre Are you sure the application successfully binds to port 5000? Have you tried running it as an administrator?

@christiansparre
Copy link
Author

Yes. It's running as admin and I can get to it from a browser and PostMan etc. :)

@christiansparre
Copy link
Author

This is how it looks :)

image

@khellang
Copy link
Contributor

khellang commented Feb 1, 2016

What if you use 127.0.0.1 instead of localhost? 😕 Could be worth looking at netstat -anb to see the interface it's bound to.

UPDATE: Might be an ab bug? http://stackoverflow.com/questions/7938869/ab-is-erroring-out-with-apr-socket-recv-connection-refused-61/8825278#8825278

@christiansparre
Copy link
Author

After trying a bit more I have had success with this example: https://github.com/roydukkey/moist/tree/stackoverflow-34615917

It uses rc2-*

It is configured for http://localhost:1234 but that does not work. With http://127.0.0.1:1234 works as expected in ApacheBench, yay! :)

I still have not had success with RC1, have tried 127.0.0.1 also, netstat reports dnx.exe listening on the right port.

So something changed in the current RC2 builds, but I can still not make localhost work.

@christiansparre
Copy link
Author

I'm going to dig a bit into this, from what I can see when it works I hit this method

protected override UvStreamHandle CreateAcceptSocket()

But not otherwise, have not looked at the kestrel code before so I'm a bit lost as to where it all starts. But I'll nose around a bit :)

@christiansparre
Copy link
Author

Ok, I'm way in over my head not known a thing about how libuv works :). The only thing I have found out is that when using localhost nothing that I can track down in krestrel is called.

There seems to be some related issues around like: #601, #406 and #426

@Tratcher
Copy link
Member

Tratcher commented Feb 1, 2016

Localhost binds to [::1] right now, not 127.0.0.1.
#231

@christiansparre
Copy link
Author

@Tratcher thank you, that explains it I think. At least for RC2, RC1 still does not work either way.

@amici
Copy link

amici commented Sep 19, 2018

What if you use 127.0.0.1 instead of localhost? 😕 Could be worth looking at netstat -anb to see the interface it's bound to.

After having the same problem (but on port localhost:80), trying with the 127.0.0.1 worked for me.

@benaadams
Copy link
Contributor

Don't think ab resolves localhost correctly

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

No branches or pull requests

5 participants