Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QLock::lock QLock::unlock() Messages flooding in console
QtWS25 Last Chance

QLock::lock QLock::unlock() Messages flooding in console

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
17 Posts 3 Posters 5.0k 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.
  • K Offline
    K Offline
    kumararajas
    wrote on 20 Mar 2017, 07:54 last edited by
    #1

    Re: Is the message "QLock::lock(): Identifier removed" anything I should be concerned about?

    Hi,

    When I run my Qt application in my embedded board, I get this message quite sometime later. I don't know the exact sequence.

    There are two interfaces -1) Application uses Message Queue 2) Application uses database.

    It looks like somewhere deadlock happened. Not exactly sure.

    I am getting much of search results in google as well.

    Any thoughts on this?

    Thank you,
    Kumara

    --Kumar

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kumararajas
      wrote on 20 Mar 2017, 09:27 last edited by
      #2

      Here is the exact error message -
      "Qlock::lock(): identifier removed"
      "QLock::unlock(): without corresponding lock"

      --Kumar

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kumararajas
        wrote on 20 Mar 2017, 16:45 last edited by kumararajas
        #3

        Any thoughts on this problem?

        --Kumar

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kumararajas
          wrote on 21 Mar 2017, 07:26 last edited by
          #4

          This might be an interesting and unique problem.

          I am running UI application in a thread, in a embedded board with QWSServer.

          I can very easily switch my application to run on a main process, but I won't be able to learn Qt internals. I would like to understand the root cause of the problem more than fixing it.

          --Kumar

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 21 Mar 2017, 07:57 last edited by
            #5

            Hi,

            Using Qt 4 ?

            Do you mean that your UI is not created in the "main" thread ?

            Why is that ?

            With the QWS system, you can have one "server" process that is the QWS server and then several applications started that will use it so if for example one is stopped or crashes, it doesn't take down the windowing system. That's a bit how Qtopia worked IIRC.

            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
            0
            • K Offline
              K Offline
              kumararajas
              wrote on 21 Mar 2017, 10:20 last edited by kumararajas
              #6

              Yes Qt 4.8

              Qt not running on a main thread
              Reason: In my application UI is configurable and my main thread has other responsibilities. So my main thread checks if UI is configured, create thread for UI and continue to process other data.

              Sam, Do you see this being a problem? Can you enlighten me with more thoughts around this? And UI running on a separate thread is becoming a point in every alternate post I create in forum. Few says, it's okay to create QApplication in a thread until or unless all the Qt objects are being created in the same thread. This is still a mystery for me.

              Will you be able clarify me in this regard?

              And how does QWSServer gets affected by Qt application running on a thread? What is the impact?

              Thank you,
              Kumara

              --Kumar

              J 1 Reply Last reply 21 Mar 2017, 12:14
              0
              • K kumararajas
                21 Mar 2017, 10:20

                Yes Qt 4.8

                Qt not running on a main thread
                Reason: In my application UI is configurable and my main thread has other responsibilities. So my main thread checks if UI is configured, create thread for UI and continue to process other data.

                Sam, Do you see this being a problem? Can you enlighten me with more thoughts around this? And UI running on a separate thread is becoming a point in every alternate post I create in forum. Few says, it's okay to create QApplication in a thread until or unless all the Qt objects are being created in the same thread. This is still a mystery for me.

                Will you be able clarify me in this regard?

                And how does QWSServer gets affected by Qt application running on a thread? What is the impact?

                Thank you,
                Kumara

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 21 Mar 2017, 12:14 last edited by
                #7

                @kumararajas said in QLock::lock QLock::unlock() Messages flooding in console:

                until or unless all the Qt objects are being created in the same thread

                Not all - only GUI related Qt classes are affected

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                K 1 Reply Last reply 21 Mar 2017, 14:16
                1
                • J jsulm
                  21 Mar 2017, 12:14

                  @kumararajas said in QLock::lock QLock::unlock() Messages flooding in console:

                  until or unless all the Qt objects are being created in the same thread

                  Not all - only GUI related Qt classes are affected

                  K Offline
                  K Offline
                  kumararajas
                  wrote on 21 Mar 2017, 14:16 last edited by
                  #8

                  @jsulm said in QLock::lock QLock::unlock() Messages flooding in console:

                  Not all - only GUI related Qt classes are affected

                  Ya that's what I meant. So, in my case, I do not go away from the thread. All the Qt GUI and other objects are being created and used in the same thread.

                  --Kumar

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 21 Mar 2017, 20:16 last edited by
                    #9

                    What kind of configuration does it do ?

                    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
                    0
                    • K Offline
                      K Offline
                      kumararajas
                      wrote on 22 Mar 2017, 06:08 last edited by
                      #10

                      Okay, I wasn't clear when I said 'UI is configurable'.

                      For my product, LCD display unit is optional, customer can prefer that or not.

                      So when LCD doesn't exist, then there is no point in have my UI application running. So, I don't create the thread if LCD is not configured.
                      This is what I called as 'UI being configurable'

                      --Kumar

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kumararajas
                        wrote on 22 Mar 2017, 10:01 last edited by
                        #11

                        I think I am pretty close to the root cause

                        Here is my architecture ( I wish I had a tool to draw here)

                        Parent Process
                        |
                        Child Process 1
                        |
                        ____________ QApplication
                        Child Process 2
                        |
                        ____________ QApplication

                        I have a parent process and multiple child processes. Each process creates it's own QApplication.

                        When I do that, I get this message on the console.

                        I have two questions

                        1. Can't have multiple QApplications in a different processes? If yes, why? When each process has it's own process memory, how they are getting linked?
                        2. Ultimately, I want just one GUI in a process. The reason for having one another QApplication is that, I am very much interested in using QWebView because of the feature it provides. For example, setHtml & print to pdf. I want to use this feature for my application, so I started to use QWebView, but webkit is much related with Qt core, it needs QApplication. So, that's the reason for ending up having one another QApplication.

                        I am happy that I am facing all the problems, because problems are real opportunities to learn. I am glad that am here, I learn a lot from you all!

                        Thank you,
                        Kumara

                        --Kumar

                        J 1 Reply Last reply 22 Mar 2017, 12:34
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 22 Mar 2017, 10:20 last edited by
                          #12

                          Hi,

                          Do you mean you are currently creating on QApplication per thread in your application ?

                          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
                          0
                          • K kumararajas
                            22 Mar 2017, 10:01

                            I think I am pretty close to the root cause

                            Here is my architecture ( I wish I had a tool to draw here)

                            Parent Process
                            |
                            Child Process 1
                            |
                            ____________ QApplication
                            Child Process 2
                            |
                            ____________ QApplication

                            I have a parent process and multiple child processes. Each process creates it's own QApplication.

                            When I do that, I get this message on the console.

                            I have two questions

                            1. Can't have multiple QApplications in a different processes? If yes, why? When each process has it's own process memory, how they are getting linked?
                            2. Ultimately, I want just one GUI in a process. The reason for having one another QApplication is that, I am very much interested in using QWebView because of the feature it provides. For example, setHtml & print to pdf. I want to use this feature for my application, so I started to use QWebView, but webkit is much related with Qt core, it needs QApplication. So, that's the reason for ending up having one another QApplication.

                            I am happy that I am facing all the problems, because problems are real opportunities to learn. I am glad that am here, I learn a lot from you all!

                            Thank you,
                            Kumara

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 22 Mar 2017, 12:34 last edited by jsulm
                            #13

                            @kumararajas Do you really mean processes and not threads?
                            "Can't have multiple QApplications in a different processes?" - sure you can, else you would not be able to execute more than one Qt app at the same time.
                            But you can only have one QApplication instance in one process.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            1
                            • K Offline
                              K Offline
                              kumararajas
                              wrote on 23 Mar 2017, 07:15 last edited by kumararajas
                              #14

                              @SGaist @jsulm

                              So, I wasn't clear in my explanation.. Did not explain fully.

                              Parent Process
                              |
                              Child Process 1
                              |
                              ____________ Do not want whole Qt features, uses QWebView for HTML to PDF conversion
                              Child Process 2
                              |
                              ____________ Create UI Thread
                              |
                              __________________________ In UI Thread, Create QApplication and build my user interface.
                              |
                              _____________Child Process 2 continue to do other activities.

                              The above, so called flow view, is not so clear, so here I shall explain.

                              Child Process 1 is used for a purpose of report generation. That uses, QWebView's method for converting HTML data into PDF. QWebView is getting inherited from QWidget, so it needs QApplication to be created in this process. Since my whole application runs on a embedded board, it works with QWSServer.

                              Child Process 2 is easy to explain. This process provides user interface. So it needs QApplication and that needs to work with QWSServer.

                              With this kind of architecture, I get QLock debug messages flooding my console.

                              If I get a doubt on UI being on a thread, I have made a quick test by running the UI application, meaning creating QApplication on Child Process 2, instead of a thread. Still the behavior is same.

                              "Can't have multiple QApplications in a different processes?" - sure you can, else you would not be able to execute more than one Qt app at the same time.
                              But you can only have one QApplication instance in one process."

                              When we say one process, in my application have multiple child processes. Can we say that each child process as one process? Or we need to say the whole application as one process?

                              Please clarify me.

                              Thank you,
                              Kumara

                              --Kumar

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on 23 Mar 2017, 22:00 last edited by
                                #15

                                What is not clear is what do you use to create these "child processes" are they QThread based ?

                                One thing you can do with QWS is to have several applications for one QWS server. e.g. you have your "main process" that knows how to configure stuff that also acts as QWS server and then you start your other applications that will connect to that server while being independent from each other.

                                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
                                0
                                • K Offline
                                  K Offline
                                  kumararajas
                                  wrote on 24 Mar 2017, 07:15 last edited by
                                  #16

                                  @SGaist said in QLock::lock QLock::unlock() Messages flooding in console:

                                  What is not clear is what do you use to create these "child processes" are they QThread based ?

                                  I use fork() to create the child process not using QThread.

                                  @SGaist said in QLock::lock QLock::unlock() Messages flooding in console:

                                  One thing you can do with QWS is to have several applications for one QWS server. e.g. you have your "main process" that knows how to configure stuff that also acts as QWS server and then you start your other applications that will connect to that server while being independent from each other.

                                  I think this will be nice solution for my problem.
                                  Can you please help me on how to do this?

                                  I did a quick try on creating QApplication with GUIServer in a main process and use it in my child process, but I was not allowed to. I was getting an error, I don't remember what was that. Is this what you want me to try or is there any other way to start the QWSServer?

                                  It will be very nice if you can show me some example.

                                  Thank you!

                                  --Kumar

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 24 Mar 2017, 20:37 last edited by
                                    #17

                                    To have several application using the same QWS server you start one application with the -qws switch and the others without. IIRC they will try to attach to the running server by themselves.

                                    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
                                    0

                                    9/17

                                    21 Mar 2017, 20:16

                                    • Login

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