Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qtcreator crashes stopping the application
Forum Updated to NodeBB v4.3 + New Features

qtcreator crashes stopping the application

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
34 Posts 5 Posters 5.6k Views
  • 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.
  • A Offline
    A Offline
    abarmotov
    wrote on last edited by
    #16
    1. create new app in creator
    2. add some little code "signalhandler"
    3. run it Ctrl-R
      4.1 kill from creator
      4.2 kill from outside konsoles
    #include "mainwindow.h"
    #include <QApplication>
    #include <unistd.h>
    #include <signal.h>
    
    void signalhandler(int sig) {
    	printf("SIG = %i\n", sig);
    	int ExitHelperCode = 0;
    	if (sig == SIGINT || sig == SIGTERM) ExitHelperCode = 123;
    	else if (sig == SIGUSR1) ExitHelperCode = 124;
    	qApp->exit(ExitHelperCode);
    }
    
    int main(int argc, char *argv[])
    {
    	signal(SIGINT,  signalhandler);
    	signal(SIGTERM, signalhandler);
    	QApplication a(argc, argv);
    	MainWindow w;
    	w.show();
    	return a.exec();
    }
    
    
    JonBJ 1 Reply Last reply
    0
    • A abarmotov
      1. create new app in creator
      2. add some little code "signalhandler"
      3. run it Ctrl-R
        4.1 kill from creator
        4.2 kill from outside konsoles
      #include "mainwindow.h"
      #include <QApplication>
      #include <unistd.h>
      #include <signal.h>
      
      void signalhandler(int sig) {
      	printf("SIG = %i\n", sig);
      	int ExitHelperCode = 0;
      	if (sig == SIGINT || sig == SIGTERM) ExitHelperCode = 123;
      	else if (sig == SIGUSR1) ExitHelperCode = 124;
      	qApp->exit(ExitHelperCode);
      }
      
      int main(int argc, char *argv[])
      {
      	signal(SIGINT,  signalhandler);
      	signal(SIGTERM, signalhandler);
      	QApplication a(argc, argv);
      	MainWindow w;
      	w.show();
      	return a.exec();
      }
      
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #17

      @abarmotov

      • Did you ever get to see the output from the printf("SIG = %i\n", sig); which is there?

      • Comment out the qApp->exit(ExitHelperCode);. Does that have any effect on the "crash" you report? And btw how do you know your app was "crashing", given that it was supposed to exit?

      It all still boils down to whether that signal handler function is being hit at all when you press the "Stop" button from Creator.

      You might also try

      signal(SIGINT,  SIG_IGN);
      signal(SIGTERM, SIG_IGN);
      

      instead as your first two lines in main().

      1 Reply Last reply
      0
      • A Offline
        A Offline
        abarmotov
        wrote on last edited by
        #18
        1. yes , i saw "SIG = 15", then kill app from from console
        2. myapp was "crashing" - that qtcreator says in output window
        JonBJ andrA 2 Replies Last reply
        1
        • A abarmotov
          1. yes , i saw "SIG = 15", then kill app from from console
          2. myapp was "crashing" - that qtcreator says in output window
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #19

          @abarmotov
          Yes, that's SIGTERM. I think you are saying it hit your printf("SIG = %i\n", sig); line, so we know it went into sighandler()? Then like I said try commenting out the qApp->exit(ExitHelperCode);, it may not be possible/safe to call that from within a signal handler.

          1 Reply Last reply
          0
          • A abarmotov
            1. yes , i saw "SIG = 15", then kill app from from console
            2. myapp was "crashing" - that qtcreator says in output window
            andrA Offline
            andrA Offline
            andr
            wrote on last edited by
            #20

            When trying to stop the application, the result is set to QProcess::CrashExit temporarily and updated whenever your process comes back with a proper exit. Your process doesn't come back with something better, so you get the "%1 crashed" response.

            I don't really see this as a bug, at best the exit code should perhaps be part of the message.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              abarmotov
              wrote on last edited by
              #21

              hm, if qApp->exit(ExitHelperCode) is not the safe - that it should to be ?
              that code works fine before qtcreator v.7 and works fine in my app as ubuntu service

              JonBJ 1 Reply Last reply
              0
              • A abarmotov

                hm, if qApp->exit(ExitHelperCode) is not the safe - that it should to be ?
                that code works fine before qtcreator v.7 and works fine in my app as ubuntu service

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #22

                @abarmotov
                That is not the current question. The question is: does the crash, misbehaviour or whatever the issue is go away if you remove that line? By now you could have given us that answer :)

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  abarmotov
                  wrote on last edited by
                  #23

                  @abarmotov said in qtcreator crashes stopping the application:

                  if i remove qApp->exit, then:

                  1. SIG = 15 and SIG = 2 printed IF i send that signals from console (or from kde task manager), but app continue working
                  2. from creator "red" button crash my app still

                  i will try to check this behavior on another machine from new user with clean configs ...

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    abarmotov
                    wrote on last edited by
                    #24

                    fresh install on new user - same behavior
                    so need to know which signal creator sends to app on press "red" button - KILL, TERM, INT ...

                    JonBJ 2 Replies Last reply
                    0
                    • A abarmotov

                      fresh install on new user - same behavior
                      so need to know which signal creator sends to app on press "red" button - KILL, TERM, INT ...

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #25

                      @abarmotov
                      I would suggest likely SIGTERM under Linux, as per https://stackoverflow.com/questions/14137808/signals-sent-by-qtcreator-on-stop from 10 years ago....

                      UPDATE
                      I was going to try your issue. Very unfortunately/scarily, the VirtualBox VM I use for Ubuntu has encountered a "critical error" while it was applying the latest Ubuntu patches (which I always do when firing up), and now will not get me into Ubuntu at all, and I don't know what to do. This has never happened before, and seems to leave me with an unrecoverable box :@ I am not a happy bunny.... Will get back to you if/when I can resolve this....

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        abarmotov
                        wrote on last edited by
                        #26

                        how to run creator with itself verbose output to see his logs ?

                        1 Reply Last reply
                        0
                        • JonBJ JonB

                          @abarmotov
                          Well most all signal handling is done by gdb, not Creator. What "crashes" when you do what? I certainly have SIGINT handling in my application and works fine under gdb/Creator. (Though I admit I do not use Creator 7.x, and wouldn't use any of the latest stuff.) Have you tried disabling your program's signal handling temporarily to see if the "crashing" goes away?

                          There should be a "debugger log window".: Window > Views > Debugger Log. This shows communicatins between Creator and gdb. That might tell you what communications happened that you are interested in.

                          Interesting blog in https://myprogrammingnotes.com/qt-creator-interact-debugger-gdb.html.

                          Code at https://github.com/qt-creator/qt-creator/blob/master/src/plugins/debugger/gdb/gdbengine.cpp. If you asked me to guess I'd hazard GdbEngine::interruptInferior()

                          No sign of any Linux signals being used to gdb. If you find otherwise let me know! :)

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #27
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • A abarmotov

                            fresh install on new user - same behavior
                            so need to know which signal creator sends to app on press "red" button - KILL, TERM, INT ...

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by
                            #28

                            @abarmotov
                            I have now recovered my Ubuntu VM successfully --- phew! :)

                            I have pasted exactly your program. Run from Creator, press red Stop button. All is well, no crash. Application Output window:

                            13:48:42: Starting /home/jon/QtTests/build-signals-Desktop-Debug/signals ...
                            SIG = 15
                            13:48:48: /home/jon/QtTests/build-signals-Desktop-Debug/signals exited with code 123
                            

                            As you can see it received a SIGTERM, it was handled and it exited cleanly.

                            Purely OOI, if run under Debug and click red Stop button program exits completely, cleanly, no crash, but does not visit the signal handler function. In this case the debugger is handling the Stop and doing whatever it does to stop its inferior process (the program being debugged) without sending it the SIGTERM signal.

                            I am Ubuntu 20.04, Qt 5.12.5 (as supplied with Ubuntu) and Qt Creator 4.11.0. I therefore conclude that this is a Creator 7.x issue. Which does not surprise me....

                            A 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @abarmotov
                              I have now recovered my Ubuntu VM successfully --- phew! :)

                              I have pasted exactly your program. Run from Creator, press red Stop button. All is well, no crash. Application Output window:

                              13:48:42: Starting /home/jon/QtTests/build-signals-Desktop-Debug/signals ...
                              SIG = 15
                              13:48:48: /home/jon/QtTests/build-signals-Desktop-Debug/signals exited with code 123
                              

                              As you can see it received a SIGTERM, it was handled and it exited cleanly.

                              Purely OOI, if run under Debug and click red Stop button program exits completely, cleanly, no crash, but does not visit the signal handler function. In this case the debugger is handling the Stop and doing whatever it does to stop its inferior process (the program being debugged) without sending it the SIGTERM signal.

                              I am Ubuntu 20.04, Qt 5.12.5 (as supplied with Ubuntu) and Qt Creator 4.11.0. I therefore conclude that this is a Creator 7.x issue. Which does not surprise me....

                              A Offline
                              A Offline
                              abarmotov
                              wrote on last edited by
                              #29

                              @JonB yes, last creator crashing my app
                              good tested on 4.15.2 - "exited with code 123"
                              made bugreport https://bugreports.qt.io/browse/QTCREATORBUG-27619

                              JonBJ 1 Reply Last reply
                              0
                              • A abarmotov

                                @JonB yes, last creator crashing my app
                                good tested on 4.15.2 - "exited with code 123"
                                made bugreport https://bugreports.qt.io/browse/QTCREATORBUG-27619

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #30

                                @abarmotov
                                OK, I had a read there, and posted my own finding.

                                The responder there says it does not happen for him on Creator 7.0.2, which is what you have? Without them being able to repro nothing can be done. If you have not done so already, I would uninstall Creator completely and re-install. Maybe try a different version, like another 7.x or a 6.x? And if you have access to another machine that might help too.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  abarmotov
                                  wrote on last edited by
                                  #31

                                  i have 7.0.2, 6.0.2 - both crashing

                                  JonBJ 1 Reply Last reply
                                  0
                                  • A abarmotov

                                    i have 7.0.2, 6.0.2 - both crashing

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by JonB
                                    #32

                                    @abarmotov
                                    I cannot comment, but you can see the person who responded to your bug report says no problem under 7.0.2. You need someone/something reproducible. [Nonetheless: report your finding for 6.0.2. too, yet not for 4.15.2, in that bug report.]

                                    It could be something in your general "environment". If you are able to try to repro on another (preferably vanilla) machine or VM that would help your cause greatly....

                                    A 1 Reply Last reply
                                    0
                                    • JonBJ JonB

                                      @abarmotov
                                      I cannot comment, but you can see the person who responded to your bug report says no problem under 7.0.2. You need someone/something reproducible. [Nonetheless: report your finding for 6.0.2. too, yet not for 4.15.2, in that bug report.]

                                      It could be something in your general "environment". If you are able to try to repro on another (preferably vanilla) machine or VM that would help your cause greatly....

                                      A Offline
                                      A Offline
                                      abarmotov
                                      wrote on last edited by
                                      #33

                                      @JonB does "current master" means 7.0.2 or last dev commit?
                                      also i have tested 7.0.2 from new user
                                      latter me try to test on fresh 22.04 ...

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        abarmotov
                                        wrote on last edited by
                                        #34

                                        on clean ubuntu 22.04:

                                        1. 7.0.2 - creator crashing my app
                                        2. build from source 8.0.0.-beta1 - exit ok (but not print exit code 123)
                                        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