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

QSerialPort::open() blocks for five seconds if port was closed



    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.12.3
    • Serial Port
    • None
    • Linux/X11


      I have written my own terminal to test my embedded devices. To not permanently block the serial port, it closes the port each time a command has been sent to the embedded device and the answer has been received.

      This works well on Windows since 2015.

      On Linux however, it only works if between the commands is more than three seconds delay. If the next command is sent in shorter time, the program blocks.

      Today I found, that QSerialPort::open() is blocking for five seconds, if the last QSerialPort::close is less than tree seconds away. I know that QSerialPort is using lock files on Linux, but I would have expected to close and re-open the port within a second.

      This is the log of the attached example program:

      "14:48:51.388: First open begin"
      "14:48:51.396: First open end"     // takes 8 milliseconds
      "14:48:52.373: First close begin"
      "14:48:52.374: First close end"    // takes 1 millisecond
      "14:48:54.228: Second open begin"
      "14:48:59.371: Second open end"    // takes 5 seconds
      "14:48:59.371: Second close begin"
      "14:48:59.372: Second close end"   // takes 1 millisecond


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            kuzulis Denis Shienkov
            aha_1980 André Hartmann
            0 Vote for this issue
            3 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes