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

QTSerialPort broken, function waitForBitesWritten ends up in Segmentation Fault

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.3.2, 6.4.2
    • Serial Port
    • None
    • Windows

    Description

      My code was working perfectly running over week with Qt 6.2.2 and later with Qt 6.3.1. First I've updated to Qt 6.4.2 and got segmentation fault from the beginning on. I use on one side com0com as virtual bridge and on the other side a W&T 13631 card. All communication is RS-485. The function that crashes the software is waitForBitesWritten (with and without a specified timeout). On the side of the virtual bridge it occurs immediately, if I disable it here, on the W&T side it will occurs after some time. With a port sniffer on the W&T device I've noticed that there Qt is sending some rubbish over the interface which causes hardware devices to send back rubbish too. The aim of my software is to sniff the communication between the software and the hardware from a 2rd party supplier (Cormet). I pass the answers from the hardware using a TCP port to my software as I need this data here too. To do this I receive the request from the Cormet software, analyze it and  pass it to the hardware, as well as I receive the answer from the hardware, analyze it and pass it to the Cormet software and additionally over TCP to my software.

      Update:

      Stack Trace is attached

      I did some further testing, the rubbish in communication was caused as I put a small delay using QTimer::singleShot after removing the waitsForBytesWritten function. Without SingleShot and waitForBytesWritten, the communication is normal, my question is now, is it safe to do just a write operation without calling waitForBytesWritten afterwards? With virtual ports the Segmentation Fault occurs immediately, as mentioned I use com0com, but I've tested also Free Virtual Serial Port (https://freevirtualserialports.com/), the behavior is the same here, Segmentation Fault comes immediately. Physical ports takes longer to crash, another software that I use with two hardware ports (one RS-232, one RS-485) took 1.5 days to crash.

      Attached also a Stack Trace while waitForBytesWritten on a real hardware serial port (W&T 13631 card).

      The environnement is MinGW 11.2.0-64Bit

      Attachments

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

        Activity

          People

            ablasche Alex Blasche
            hans_kottmann Hans Kottmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes