Skip to content

Handling of queued clients and timeout #4

@v6ops

Description

@v6ops

Hi,

First thanks so much for sharing your code. There really are very few usable examples of multithreaded libevent that can be used as a tutorial.

I see something that I perceive as an issue. Correct me if I'm wrong.

I start a server with 2 threads on a server with 2 CPU.
I connect 3 independent telnet clients a,b,c close in time to each other to create congestion.

client a connects and echos immediately. There are messages from thread [10] on the server
client b connects and echos immediately. There are messages from thread [14] on the server
client c connects immediately (process is listening) but does not echo (event is not triggering).
I'd expect this as there are #define CONNECTION_BACKLOG 8 on the TCP socket.

I now leave client b to time out after SOCKET_READ_TIMEOUT_SECONDS 100.
Client a continues working normally. Client c is never serviced.

Now what I think is abnormal. Client b times out expires. Client c times out simultaneously and never gets serviced.

Is this expected behaviour, a bug, or a limitation in libevent?

Shouldn't the code be using something like evconnlistener_new_bind rather than listening and binding independently of libevent?

I can debug further on request if you're still maintaining this code.

best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions