Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. App will only run once?

App will only run once?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 868 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    year19100
    wrote on last edited by
    #1

    A console app I've been writing has been working great cross platform (OS X, Linux, Windows) until recently. Now when I run the app on any platform it will only start the first time it is executed. After the first execution, wether you start as a daemon and kill the process or start on the command line and ctrl-c, the application just returns to the command line. No exit code, no application output. I use QCommandlineParser for version and help information and even those do not respond on the subsequent calls.

    If I was the only one working on the project I'd just back out changes until it worked again, but I've had to merge some branches from others which makes that much more difficult (but I still may need to do this). My searches haven't given me any insight as to what would cause this. Hopefully someone here has an idea.

    It's not visible in the process list and the only thing that seems to work is rebooting the computer and then it will launch on the first try again.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      Do you use something that tries to limit the number of instances of the program (something like QSingleInstance). Maybe each subsequent attempt to run the program exits since it thinks it is already running?

      If not this then maybe adding a few qDebug commands to see where the program exists.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Before rolling back the changes you merged, you can use the debugger to get some insights of what is going on.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • Y Offline
          Y Offline
          year19100
          wrote on last edited by year19100
          #4

          I was looking in all the wrong places. So it goes.

          Thanks @Rondog and @SGaist; sometimes you need to rubber duck it from the beginning.

          For archival purposes here is what it was.

          1. Bad practices. The merged code had a QSharedMemory creation and check in there that, unbelievably:
          • returned zero if the creation failed
          • didn't check the error code and take the appropriate action
          • gave no feedback at all that something unwanted happened
          1. Brain fart. I didn't catch the return code because my brain seemed to think that $! echoed the return code instead of $?. So that was my bad and what exacerbated the debugging of the issue.
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved