Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28539

QTcpSocket/QCtpServer signals emmited to late when writing into a file with another thread

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.2
    • None
    • Linux Mint LMDE 64bits, Qt using glib

    Description

      I have a program where the main thread is a WebServer through a QTcpServer and another thread writing big data in a file. The server work with the event system, using newConnect and readyRead signal...

      When the thread is writing into the file, if i try to request for a page from my web server, the response can take lots of time to come. This problem appears randomly but often (~1/5 request), and all problems disappears when the thread has finished to write the file. I use the server on my local machine, so it's not a network speed problem

      I build a simple program (in attachment) that reproduce the problem and i compile Qt to try to find the problem. I think the problem is around the file descriptor poll system in the qt glib implementation (QEventDispatcherGlib).
      What i think is maybe, when writing in the binary file fd, the poll notifier system is overloaded and doesn't find time to notify the socket fd.
      Maybe this is the default behavior and it's normal, or it's a glib or libc problem, nevertheless i can tell that is not usable like this.

      I can specify that before using event system for my program i was using the wait* function, i wasn't having any problem.

      To reproduce the problem, see the test program in attachment, compile and run the program, and go immediately in the browser to load a page in the webserver http://localhost:8081/. Type F5, often to increase your chance to reproduce the problem.

      I already open a discussion here, but i didn't get any answer: http://qt-project.org/forums/viewthread/22641/

      Attachments

        1. LogNoSleep.txt
          11 kB
        2. TestQtBlocked.zip
          5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            ebeuque Eric Beuque
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes