Skip to content

Responses never terminate (ab dies with timeout error) (OS X) #16

Open

Description

@joshgoebel

Using latest jester and Apache bench and for some reason it thinks the requests timeout. Perhaps we're not closing a socket properly or something? It's 100% reproducible here and only with httpbeast. asynchttpserver does not have the same issue.

nim c -d:release -r tests/example
...

INFO Jester is making jokes at http://0.0.0.0:5000
Starting 1 threads
ab -r -n 1000 -c 1000 http://0.0.0.0:5000/
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 0.0.0.0 (be patient)
apr_pollset_poll: The timeout specified has expired (70007)

Seems to work fine in browser and with curl. AB is receiving the responses (if I used -v2), but obviously something else is off.

Thoughts?

Activity

  1. changed the title [-]Responses never terminate (OS X)[/-] [+]Responses never terminate (ab dies with timeout error) (OS X)[/+] on Oct 15, 2018
  2. joshgoebel commented on Oct 15, 2018

    @joshgoebel
    Author

    Pretty sure this is because we don't yet support close=0 or keep-alive=0.

  3. dom96 commented on Oct 15, 2018

    @dom96
    Owner

    Hrm, interesting. Not sure what the problem could be, I'd need to look into how apache bench creates requests.

  4. joshgoebel commented on Oct 15, 2018

    @joshgoebel
    Author
            if data.sendQueue.len == data.bytesSent:
              data.bytesSent = 0
              data.sendQueue.setLen(0)
              data.data.setLen(0)
    
              # selector.unregister(fd)
              # fd.SocketHandle.close()
              selector.updateHandle(fd.SocketHandle,
                                    {Event.Read})
    

    Adding the two commented lines fixed it for me... but of course (if this is the proper place to add them) they would need to be dependent on the Close/Keep-Alive/ and HTTP version. You can see how it's done in asynchttpserver if you want a reference.

    ab is using HTTP/1.0 (though it doesn't seem to mind the 1.1 being returned) which by default expects keep-alive to be off and the connection to be terminated by the server - which we aren't doing.

  5. 2vg commented on Oct 25, 2018

    @2vg

    @yyyc514 You can use wrk instead of ab.
    Although ab is a single thread and old tool, but wrk runs in multithreading.
    If you want to use wrk with single thread, simply specify -t 1 with the command line option.
    wrk -t 1 http://localhost:8080
    Techempower, a famous benchmark, also uses wrk to measure it.

  6. joshgoebel commented on Oct 26, 2018

    @joshgoebel
    Author

    Yeah I've been using wrk, but still think httpbeast isn't doing the correct connection handling here.

  7. kolesar-andras commented on Nov 18, 2022

    @kolesar-andras

    Same problem here.

  8. treeform commented on Nov 26, 2022

    @treeform

    I also ran into this.

  9. treeform commented on Nov 26, 2022

    @treeform

    I tried this work around by adding req.client.close() to end of requests, but I get this error after some requests:

    Error: unhandled exception: ioselectors_epoll.nim(147, 11) `s.fds[fdi].ident == InvalidIdent` Descriptor 118 already registered [AssertionDefect]```
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions