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



  • 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



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



  • Any thoughts on this problem?



  • 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.


  • Lifetime Qt Champion

    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.



  • 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


  • Moderators

    @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



  • @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.


  • Lifetime Qt Champion

    What kind of configuration does it do ?



  • 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'



  • 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


  • Lifetime Qt Champion

    Hi,

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


  • Moderators

    @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.



  • @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


  • Lifetime Qt Champion

    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.



  • @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!


  • Lifetime Qt Champion

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.