Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Freeing file handles created by Qt
Qt 6.12 LTS is out! See what's new in the release blog

Freeing file handles created by Qt

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 6 Posters 7.5k Views 4 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.
  • S Sebi1729

    @mrjj
    I noticed that my Views tab us greyed out. Where does the Qt store logs by default? Stockfish at most writes to files in a local directory; it doesn't have any fancy logic.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #10

    @Sebi1729 Did you try to disable your anti-virus application?

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

    mrjjM 1 Reply Last reply
    2
    • jsulmJ jsulm

      @Sebi1729 Did you try to disable your anti-virus application?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #11

      @jsulm
      hi
      yes he wrote

      • Disabling McAfee didn't work either

      But i was wondering about windows defender.

      1 Reply Last reply
      1
      • S Sebi1729

        @mrjj
        I noticed that my Views tab us greyed out. Where does the Qt store logs by default? Stockfish at most writes to files in a local directory; it doesn't have any fancy logic.

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

        @Sebi1729
        Windoze is notorious for having file handles left open/locked preventing overwrite, and it often does boil down to some AV. Make sure any & all AV is disabled and test.

        You really ought to be able to use something like procexp to see what executables/handles are open by whom etc. If you have run stockfish.exe it only takes one thread inside it to still be running to prevent deletion. Try a little kill program to see if that terminates it correctly if it's still running.

        The other possibility (hack) to get you going is that often Windoze allows open file rename where it does not allow delete/overwrite. You might try renaming to a temp file prior to re-link.

        kshegunovK 1 Reply Last reply
        3
        • JonBJ JonB

          @Sebi1729
          Windoze is notorious for having file handles left open/locked preventing overwrite, and it often does boil down to some AV. Make sure any & all AV is disabled and test.

          You really ought to be able to use something like procexp to see what executables/handles are open by whom etc. If you have run stockfish.exe it only takes one thread inside it to still be running to prevent deletion. Try a little kill program to see if that terminates it correctly if it's still running.

          The other possibility (hack) to get you going is that often Windoze allows open file rename where it does not allow delete/overwrite. You might try renaming to a temp file prior to re-link.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #13

          @JNBarchan said in Freeing file handles created by Qt:

          Windoze is notorious for having file handles left open/locked preventing overwrite, and it often does boil down to some AV.

          Actually it really boils down to "programmers" that don't take care to run a graceful shutdown sequence. Those people, from my observations, are often one and the same as the ones that believe leaking memory from global scope variables on program exit is just fine "because the OS will clean it up".

          @Sebi1729 said in Freeing file handles created by Qt:

          Is there a better way of attaching gdb to a process?

          You can attach QtCreator, from the menu Debug > Start Debugging > Attach to Running Application ... select the process from the list. Make sure you're using a debug build so you get the debug information.

          Read and abide by the Qt Code of Conduct

          S 1 Reply Last reply
          2
          • S Offline
            S Offline
            Sebi1729
            wrote on last edited by
            #14

            @jsulm

            Yes, I disabled all antiviruses I was aware of.

            @JNBarchan

            I managed to close the handle using process hacker (it comes with a driver which can close any open handle). However, this is not a long term solution since handles are recycled on windows (which likely ends up in file corruption).

            @kshegunov

            I tried this in two cases; attaching gdb to stockfish before starting it and while running. The end result was the same: I got into ntdll.dll and started stepping through machine level code (F10/F11) and at some point gdb started to hang. Upon exit I could no longer reattach nor rebuild stockfish. Source code was not available during step by step debugging. Right now I am thinking of recording a few games and replaying the UCI transcript to stockfish from Qt (in the first case I was launching stockfish with an external application (chess) Arena).

            kshegunovK JonBJ 2 Replies Last reply
            0
            • S Sebi1729

              @jsulm

              Yes, I disabled all antiviruses I was aware of.

              @JNBarchan

              I managed to close the handle using process hacker (it comes with a driver which can close any open handle). However, this is not a long term solution since handles are recycled on windows (which likely ends up in file corruption).

              @kshegunov

              I tried this in two cases; attaching gdb to stockfish before starting it and while running. The end result was the same: I got into ntdll.dll and started stepping through machine level code (F10/F11) and at some point gdb started to hang. Upon exit I could no longer reattach nor rebuild stockfish. Source code was not available during step by step debugging. Right now I am thinking of recording a few games and replaying the UCI transcript to stockfish from Qt (in the first case I was launching stockfish with an external application (chess) Arena).

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #15

              @Sebi1729 said in Freeing file handles created by Qt:

              I got into ntdll.dll and started stepping through machine level code (F10/F11) and at some point gdb started to hang.

              You should get access to the call stack when you attach to a debug build, you can then inspect what called what.

              Upon exit I could no longer reattach nor rebuild stockfish.

              Who's exit? After you've attached the debugger you can close the instance by Shift+F5, but if the program has acquired a global mutex/semaphore or any other global resource this may be left uncleaned (although the debugger/OS should do it in principle).

              Right now I am thinking of recording a few games and replaying the UCI transcript to stockfish from Qt (in the first case I was launching stockfish with an external application (chess) Arena).

              What exactly are you trying to do?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              2
              • S Sebi1729

                @jsulm

                Yes, I disabled all antiviruses I was aware of.

                @JNBarchan

                I managed to close the handle using process hacker (it comes with a driver which can close any open handle). However, this is not a long term solution since handles are recycled on windows (which likely ends up in file corruption).

                @kshegunov

                I tried this in two cases; attaching gdb to stockfish before starting it and while running. The end result was the same: I got into ntdll.dll and started stepping through machine level code (F10/F11) and at some point gdb started to hang. Upon exit I could no longer reattach nor rebuild stockfish. Source code was not available during step by step debugging. Right now I am thinking of recording a few games and replaying the UCI transcript to stockfish from Qt (in the first case I was launching stockfish with an external application (chess) Arena).

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

                @Sebi1729 said in Freeing file handles created by Qt:

                @JNBarchan

                I managed to close the handle using process hacker (it comes with a driver which can close any open handle). However, this is not a long term solution since handles are recycled on windows (which likely ends up in file corruption).

                The intention was not necessarily to repeatedly use an external close-handle-program, it was to identify which process has the handle open to diagnose the issue.

                1 Reply Last reply
                1
                • kshegunovK kshegunov

                  @JNBarchan said in Freeing file handles created by Qt:

                  Windoze is notorious for having file handles left open/locked preventing overwrite, and it often does boil down to some AV.

                  Actually it really boils down to "programmers" that don't take care to run a graceful shutdown sequence. Those people, from my observations, are often one and the same as the ones that believe leaking memory from global scope variables on program exit is just fine "because the OS will clean it up".

                  @Sebi1729 said in Freeing file handles created by Qt:

                  Is there a better way of attaching gdb to a process?

                  You can attach QtCreator, from the menu Debug > Start Debugging > Attach to Running Application ... select the process from the list. Make sure you're using a debug build so you get the debug information.

                  S Offline
                  S Offline
                  Sebi1729
                  wrote on last edited by
                  #17

                  @kshegunov

                  What exactly are you trying to do?
                  

                  Arena is a UCI client that interacts with stockfish by sending/receiving messages with the next move of each player. I want to save the transcript to a log file, modify stockfish as to read it and infer its behavior through debugging.

                  kshegunovK 1 Reply Last reply
                  0
                  • S Sebi1729

                    @kshegunov

                    What exactly are you trying to do?
                    

                    Arena is a UCI client that interacts with stockfish by sending/receiving messages with the next move of each player. I want to save the transcript to a log file, modify stockfish as to read it and infer its behavior through debugging.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #18

                    Stockfish is open source, so you can build and modify it yourself. I really don't get why you're trying to reverse engineer the engine ...

                    Read and abide by the Qt Code of Conduct

                    S 1 Reply Last reply
                    0
                    • kshegunovK kshegunov

                      Stockfish is open source, so you can build and modify it yourself. I really don't get why you're trying to reverse engineer the engine ...

                      S Offline
                      S Offline
                      Sebi1729
                      wrote on last edited by
                      #19

                      @kshegunov
                      I'm not trying to reverse engineer per-se but rather have a deeper understanding on how moves are computed given a game state; I'm planning on improving the engine with some machine learning algorithms.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        Sebi1729
                        wrote on last edited by
                        #20

                        Merge double posts later. Apparently, McAfee can't exclude directories from scanning. It even blocks the linker from visual studio thus making any windows box useless for (binary application) development.

                        I fixed it by:

                        • uninstalling McAfee

                        • flaming the cretins who thought this was a good idea

                        1 Reply Last reply
                        3

                        • Login

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