Nominate our 2022 Qt Champions!

Program Crashing while attempting to connect through Serial Port

  • This is an application that connects to a device product via Serial Port. The program always worked until I started making some changes to the project to add data logging capabilities. All of a sudden when I try to run the program to see my changes in effect; the program crashes during the attempted connection and all it outputs is:

    16:26:03: Starting C:\Work\SVN\Spartacus\build-Spartacus-Desktop_Qt_5_11_2_MinGW_32bit-Debug\debug\spartacus...
    libpng warning: iCCP: profile 'ICC Profile': 'CMYK': invalid ICC profile color space
    "Semaphore resource could not be acquired."
    "Semaphore resource could not be acquired."
    "Semaphore resource could not be acquired."

    What does "Semaphore resource could not be acquired" mean?.

    I reverted all my changes. went back to the original project files that I branched from and have the same error happen. I even went back to the trunk and it still happens. I did not have this issue before I tried making the changes for this new feature. I have made changes before and did not have the issue either. The error description is obvious but how do I correct it? Is this a Qt issue? Thanks for the help.

  • Lifetime Qt Champion


    Did you try to run your application through the debugger to get a stack trace ?

  • Can you explain how to do that? I'm running Qt in Windows. Do you mean debugging with GDB?

  • Lifetime Qt Champion


    exactly. start the debugger an on crash inspect the stack trace in QtCreator.

    Note that the debugger might first show system or Qt code, but usually go some stack levevls up and there is an bug in your code

  • So I ran the cleanup in SVN and checked the delete all non-versioned items. This seemed to clear up the issue. I can't recreate the error again. However I found it really odd that this issue even came up.

  • Looks to me from your errors and your comment later that the resource itself was being consumed by another process.

    I have had occasions in multiple languages where my program crashes or closes without releasing the serial resource. in which case firing up the program again has issues because it believes the resource is still in use.

  • @MrShawn I think that is what the issue was. Oh well. Thanks.

  • @ndijkhoffz if your issue is solved, please don't forget to mark your post as such! Thanks.

Log in to reply