Skip to content

Conversation

@heifner
Copy link
Contributor

@heifner heifner commented Dec 4, 2025

The read only tests use multiple threads to push transactions. These end up trying to write to the subprocess_results.log at the same time. Protect the write with a lock.

@greg7mdp
Copy link
Contributor

greg7mdp commented Dec 4, 2025

Wouldn't the following work and avoid re-opening the file every time checkOutputFileWrite is called?

        with Utils._check_output_lock:
            if not hasattr(Utils, "checkOutputFile"):
                Utils.checkOutputFilename=f"{Utils.DataPath}/subprocess_results.log"
                if Utils.Debug: Utils.Print("opening %s in dir: %s" % (Utils.checkOutputFilename, os.getcwd()))
                Utils.checkOutputFile=open(Utils.checkOutputFilename,"w")

        with Utils._check_output_lock:
            Utils.checkOutputFile.write(Utils.FileDivider + "\n")
            Utils.checkOutputFile.write("start={%s}\n" % (time))
            Utils.checkOutputFile.write("cmd={%s}\n" % (" ".join(cmd)))
            Utils.checkOutputFile.write("cout={%s}\n" % (output))
            Utils.checkOutputFile.write("cerr={%s}\n" % (error))
            Utils.checkOutputFile.write("stop={%s}\n" % (stop))

@heifner
Copy link
Contributor Author

heifner commented Dec 4, 2025

Wouldn't the following work and avoid re-opening the file every time checkOutputFileWrite is called?

I kind of like opening to append each time. The close makes sure it is flushed. Not like performance matters here.

@greg7mdp
Copy link
Contributor

greg7mdp commented Dec 4, 2025

Sound fine. Still I think we should take the lock for the open as well to avoid contention when writing into Utils.checkOutputFilename.

cc32d9 added a commit to eos-amsterdam-rnd/antelope_spring_ce that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants