Git Product home page Git Product logo

Comments (3)

bzeller avatar bzeller commented on June 26, 2024

After thinking about this some more, i would propose a change where we put the Request objects inside QSharedPointers, where as long as the request is valid the HttpServer holds a copy. When the request is
invalid because the connection was closed, the server removes that copy. The request object itself will
stay as long as there are other copies out in the wild.

On second thought that would mean a source compatibility break, because that shared object of course
needs to be used everywhere , also in usercode. But maybe we could create something like a shared
backend of HttpServerRequest ( HttpTcpRequestBackend, HttpFCGIRequestBackend) that goes invalid
when the request was closed.

To make that happen we of course would need some state and error checking code in HttpServerRequest:

HttpServerRequest::isValid or HttpServerRequest::isAlive
HttpServerRequest::hasError
HttpServerRequest::error

and so on.

from tufao.

vinipsmaker avatar vinipsmaker commented on June 26, 2024

Httperf opens lots of connections at the same time and runs requests on the server.
Every request has a timeout and if the timeout is reached it just closes the socket.
This may be no problem with the non threaded version ( i didn't check yet) but in the
threaded version you have pending requests if the server load is high.
They are waiting in a queue, the problem is if they reach the connection timeout the
sockets are closed and deleted WHILE they are still waiting. Also we don't have
socket error handling code (a error maybe should emit some signal and close the
request).

The threaded abstraction can disable the timeout while the request is queued.

  1. The requests object are deleted behind the back of the application, i worked
    around this by using QPointer objects , so at least i know when they are gone.

I see.

For simple applications there isn't any problem, but if you "store" the request objects, you is going to have troubles.

What do you think about this:

  1. Implement a new signal, HttpServerRequest::timeoutReached()
  2. HttpServer connects timeoutReached() to the QAbstractSocket::close() to maintain backwards compatibility.
  3. Complex applications can handle the timeout themself and the request object won't be deleted behind their back.

The question is if we should think about a different approach than directly connecting
request objects to their deleteLater slot, so we can handle these things better.

This is the simplest solution if we don't need special code to be triggered before deletion. The solution can be changed and I don't care, but what special code needs to be triggered before deletion?

from tufao.

bzeller avatar bzeller commented on June 26, 2024

I think this issue is gone with the fd-based thread code. Since in the handler thread the workflow is exactly
as it would be in a single thread application

from tufao.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.